LLVM Discussion Forums

A question on linalg::PoolingSumOp

Hi everybody!
I have a problem, connected with use of linalg::PoolingSumOp. I’m trying to calculate sum pooling 3x3 on <1x1x9x9xf32> nchw tensor. This tensor doesn’t contain any zero paddings. The mlir operation I use for that is like following

linalg.pooling_sum(%2, %0, %1) {dilations = [1, 1, 1, 1], padding = dense<[[0, 0], [0, 0], [1, 1], [1, 1]]> : tensor<4x2xi64>, strides = [1, 1, 1, 1]} : memref<1x1x9x9xf32>, memref<1x1x3x3xf32>, memref<1x1x9x9xf32>

The result of calculation I receive is good excluding 1-st and last columns of 9x9 matrix - they are incorrect. By analyzing it I made out that algorithm takes extra elements from adjacent rows when sliding window 3x3 is situated on the left/right edges of the input tensor. When the sliding window is situated on up/down edges of input tensor, the result is correct.
Meantime, if I use linalg.conv_op for the same purpose, the result of calculations is fully correct including edge rows and columns.
What I do wrong with this?
Thank you in advance for your answers.