MaxPool2d output size

Hi All,

I found out the output size of the MaxPool2d could be not consistent with the formula in the document.

My MaxPool2d and the input are declared as:

nn.MaxPool2d(kernel_size=4, stride=4, padding=1)
inputs = torch.randn(1, 1, 1, 1)

According to the output size formula in the document, the output height/width should be:
floor((1 + 2 * 1 - 1 * (4 - 1) - 1) / 4 + 1) = floor(0.75) = 0

However the actual output size is (1x1x1x1)

The PyTorch version is 1.2.0
Does anyone have the same question here? Many thanks!

Your square_size is 1 and it didn’t raise an runtime error?

Yes, my square_size is 1. And PyTorch generate an output of size 1x1x1x1.