Valid padding or zero padding?

Let’s say I want the convolutional layer output volumes to preserve the spatial size of the input volumes, but the pooling layer output volumes reduce the dimension of the input volume. Is this to say that I’ve to use zero padding? When the stride is 1 and the pooling value is 2, how will this affect the relationship between the kernel size and the padding? The input dimension is [60000, 28, 28]

I don’t think you can use maxpool and still be able to preserve dimensions.

import torch
from torch.nn import MaxPool2d
input = torch.rand((1, 60000, 28, 28))
maxpool = MaxPool2d(2,stride=1, padding=1)
output = maxpool(input)
output.size()
>>>torch.Size([1, 60000, 29, 29])

You may play with different values of maxpool parameters, but “…pad should be smaller than or equal to half of kernel size…”

1 Like