Nilakshan_Kunanantha:

56x56


Hi,
Usually the output size is calculated as follow.
O = floor((W-K+2P)/S) + 1

If the ceil mode is on, ceil used instead of floor operation in the output. That is what said in the documentation. You can refer here.
https://pytorch.org/docs/stable/_modules/torch/nn/modules/pooling.html 216
In the case of ceil mode, additional columns and rows are added at the right as well as at the down. (Not top and not left). It does not need to be one extra column. It depends on the stride value as well. I just wrote small code snippet where you can check how the populated values are pooled in either modes.
import torch.nn as nn
import torch

test = torch.randn(2,3,32,32)
x = torch.tensor([[-2, 1, 2, 6, 4], [-3, 1, 7, 2, -2], [-4, 2, 3, -1 , -3], [-7, 1, 2, 3, 11], [5, -7, 8, 12, -9]]).float()
x = x.unsqueeze(0)
y_1 = nn.MaxPool2d(kernel_size=2,stride=2, padding=0)
y_2 = nn.MaxPool2d(kernel_size=2,stride=2, padding=0, ceil_mode=True)
print(y_1(x))
print(y_2(x))

Thanks