Skip to content

fix: set padding with lowest value for paddedMaxPool

Houssem ROUIS requested to merge fix_maxpool into dev

Context

This merge request is intended to fix paddedMaxPooling behaviour.
As explained in aidge_backend_cpu#46 (moved), the current behaviour of the MetaOp does not align with ONNX and Pytorch as the padded value (0 by default) might take over the max value and replace the tensor's value if all the values in a window are negative:

input tensor =
            [[[[-1, 2, 3, 4],
               [5, 6, 7, -8],
               [9, 10, 11, 12],
               [13, 14, 15, -16]]]]
Aidge output = 
            [[[[ 0.  3.  4.]
               [ 9. 11. 12.]
               [13. 15.  0.]]]]

ONNX output =
            [[[[ -1.   3.   4.]
               [  9.  11.  12.]
               [ 13.  15. -16.]]]]

To fix this, we simply set the padding value to the lowest value, that way it doesn't take over the original tensor's values even if they are negative.

Merge request reports

Loading