How to find output of MaxPool2d for odd dimensions

How can I find row the output of MaxPool2d with (2,2) kernel and 2 stride with no padding for an image of odd dimensions, say (1, 15, 15)?

I saw the docs, but couldn’t find anything useful.

The formula to compute the output shape is given at the end of the documentation:
just before the “examples”.

With height = 15, padding = 0, kernel_size = 2, stride = 2 and dilation = 1, the formula works out to be:

[15 + 2*0 - 1(2-1)-1]/2 + 1 = 15/2

Now, what would be the image dimensions, given the formula gives a fractional value?

I didn’t check the content of your formula. However, I see that you forgot ( or you are not familiar with the notation ) the flooring function ( the “L” and its symmetric counterpart ) around the formula.


I wasn’t at all familiar with that notation. I just gave a passive view to it, previously. Thanks a lot for pointing that out.