ComputeLibrary icon indicating copy to clipboard operation
ComputeLibrary copied to clipboard

NEConvolutionLayer : missing padding for input data tensor

Open joel-mi opened this issue 9 years ago • 4 comments

I'm trying to configure convolution layer for an input image of 32x32x3 and output of 32x32x40, filter size = 3x3 For this purpose, I'm performing the settings as follows :

  • PadStrideInfo convolutionPadStrideInfo(1, 1, 1, 1);
  • input data tensor : const TensorShape shape(32, 32, 3);
  • output data tensor : const TensorShape shape(32, 32, 40);
  • weights tensor : const TensorShape shape(3, 3, 3, 40);
  • biases tensor : const TensorShape shape(40);

After activating NEConvolutionLayer::configure and allocating all tensors, I checked input data tensor and I noticed the following :

  • info()->has_padding() returns FALSE
  • strideInBytes.y = 128 (32 * 4)
  • strideInBytes.z = 4096 (32 * 32 * 4)

So it shows that input data tensor has no padding, although I would expect with my settings a padding of 1 column to the right and to the left, and 1 row to the top and bottom Is there anything I'm not configuring correctly ?

joel-mi avatar May 04 '17 08:05 joel-mi

Hello @joel-mi,

Is you result correct though? I assume this happens because the specified padding that you add is handled by the Im2Col kernel. So the Im2Col kernel will account this but will not add padding "physically" to the input tensor itself. Does this answer you question?

Regards, George

GeorgeARM avatar May 04 '17 09:05 GeorgeARM

the results are not correct but this is probably due to other causes (I'm currently debugging) Please notice that I'm using this information (has_padding, strideInBytes.y, strideInBytes.z) for loading the input tensor with input image data; if has_padding() returns FALSE, I'm using a single memcpy for writing whole input data to tensor's buffer. Is this correct ?

joel-mi avatar May 04 '17 09:05 joel-mi

Hello @joel-mi,

Yes if no padding has been allocated then you can make a single memcpy. Can you post your code so that we can help you out?

GeorgeARM avatar May 04 '17 11:05 GeorgeARM

It's working fine now - this issue is solved

joel-mi avatar May 08 '17 10:05 joel-mi