keras icon indicating copy to clipboard operation
keras copied to clipboard

averagePooling2D calculates wrongly with torch backend

Open AGFACBNNR opened this issue 1 year ago • 1 comments

As shown in this colab, AveragePooling2D generate an output with wrong shape with torch backend. Specifically, the bug is triggered only when padding='same' and input_height != input_weight. Details can be checked in the shared colab, currently the output is: 1715913721152 When the bug is triggered(line 2 and line 5 in output), the output has an wrong shape.

AGFACBNNR avatar May 17 '24 02:05 AGFACBNNR

Besides, averagePooling3D and maxpooling2D have similar problems, possibly because of their same base class.

AGFACBNNR avatar May 17 '24 02:05 AGFACBNNR

Sorry for the delay on this! Valid bug!

In fact we have some tests disabled on the torch backend for padding same for this reason it looks like. https://github.com/keras-team/keras/blob/61ea9c61f08f2a7b06091c63f032fc5e7839fb4f/keras/src/ops/nn_test.py#L1338-L1342

Marking this as open for contributions in case anyone would like to take this one. If not will try to get to this soon.

mattdangerw avatar Jul 12 '24 00:07 mattdangerw

Are you satisfied with the resolution of your issue? Yes No

google-ml-butler[bot] avatar Jul 12 '24 19:07 google-ml-butler[bot]

Are you satisfied with the resolution of your issue? Yes No

google-ml-butler[bot] avatar Jul 12 '24 19:07 google-ml-butler[bot]