averagePooling2D calculates wrongly with torch backend
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:
When the bug is triggered(line 2 and line 5 in output), the output has an wrong shape.
Besides, averagePooling3D and maxpooling2D have similar problems, possibly because of their same base class.
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.