output mismatch after running NEConvolutionLayer + NEActivationLayer(RELU) together
Hi,
Configs: Version : Computelibrary 18.05 Platform : arm7a Operating System: linux
Issue:
The sample application code of mine having NEConvolutionlayer + NEActivationlayer(RELU) does not give me the correct output .
But when I dumped output of convolution into a file and separately feed to (NEActivationLayer), the output is correct .
Please find the following code snippet:
const TensorShape dst_conv1_shape((size_t)w, (size_t)h, (size_t)c);
dst_conv1.allocator()->init(TensorInfo(dst_conv1_shape, 1, DataType::F32));
TensorShape dst_conv2_shape = dst_conv1_shape ;
dst_conv2_shape.set(0 , std::ceil(dst_conv2_shape.x()/2 ));
dst_conv2_shape.set(1 , std::ceil(dst_conv2_shape.y()/2 ));
dst_conv2_shape.set(2 , (size_t)64);
dst_conv2.allocator()->init(TensorInfo(dst_conv2_shape, 1, DataType::F32));
TensorShape dst_act_shape = dst_conv2_shape ;
dst_act.allocator()->init(TensorInfo(dst_act_shape, 1, DataType::F32)); //same shape as that of conv2 output
conv2.configure(&dst_conv1, &conv2_weight, nullptr, &dst_conv2, PadStrideInfo(2, 2, 0, 1, 0, 1, DimensionRoundingType::FLOOR) );
act.configure(&dst_conv2, &dst_act, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) );
dst_conv1.allocator()->allocate();
printf("fil source \n");
float *mem = (float*)dst_conv1.buffer();
for (int i = 0; i < h*c*w; i++)
a = fscanf(fp, "%f", mem + i);
printf("fil source over \n");
dst_conv2.allocator()->allocate();
dst_act.allocator()->allocate() ;
//------------------------------------------------------------------------
The above code does not output correctly in the destination tensor dst_act. But when I dumped data of tensor dst_conv2 in a file and feed it separately into act{} (NEActivationLayer) , correct output is shown by the destination tensor dst_act.
I could not figure out what the error can be. I'm initializing the tensors before the configure() and allocating them after configure.
Kindly help me with a solution,
for (int i = 0; i < h*c*w; i++)
a = fscanf(fp, "%f", mem + i);
That's wrong, you need to take the padding into account, see this thread
Hi Anthony,
Now, I'm reading the input and dumping the output using execute loop window as mentioned in https://arm-software.github.io/ComputeLibrary/v18.03/architecture.xhtml#S4_6_4_working_with_objects
even then I see the output mismatched with the reference dump.
As mentioned earlier, Relu activation layer is working fine individually and dumping correctly. But when it is called after Convolutionlayer , the output is mismatched
Kindly help me with this issue
Please post the whole code so that we can reproduce the issue
From: ved27 [email protected] Sent: Monday, 2 July 2018 15:37 To: ARM-software/ComputeLibrary Cc: Subscribed Subject: Re: [ARM-software/ComputeLibrary] output mismatch after running NEConvolutionLayer + NEActivationLayer(RELU) together (#480)
Hi Anthony,
Now, I'm reading the input and dumping the output using execute loop window as mentioned in https://arm-software.github.io/ComputeLibrary/v18.03/architecture.xhtml#S4_6_4_working_with_objects
even then I see the output mismatched with the reference dump.
As mentioned earlier, Relu activation layer is working fine individually and dumping correctly. But when it is called after Convolutionlayer , the output is mismatched
Kindly help me with this issue
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/ARM-software/ComputeLibrary/issues/480#issuecomment-401826960, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZt0SqapOG5pKHnPcuA5kUK0HeB1uNf7ks5uCjAfgaJpZM4U_Lk4.
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Hi,
I shall check and let you know if the whole code can be shared on public domain
Currently the mismatched values are 0.06 ~ 0.08 less than the actual values. What all can be the possible obstacles for this kind of issue ?
Thank you
Hi @ved27,
could you run your test case without the activation layer (only convolution layer) and check if you have the same mismatch at the same location of 0.06? Since you are using a ReLu activation, the positive results should not be affected as the operation is simply max(0, input_value).
Thanks, Gian Marco
Hi @gmiodice
Thank you for your response. Now, I changed all the memory access of input and output tensors as suggested by you people. It's working now. The output is matching
But I still wonder how few outputs in previous testing scenarios are matching despite the contiguous memory access of tensors which are having padding
Thank you,