I was going to implement the spatial pyramid pooling (SPP) layer, so I need to use F.max_pool2d function. Unfortunately, I got a problem as the following:
invalid argument 2: pad should be smaller than half of kernel size, but got padW = 2, padH = 1, kW = 3, kH = 2 at /pytorch/torch/lib/THCUNN/generic/SpatialDilatedMaxPooling.cu:39
torch.Size([1, 512, 7, 9])

So I want to ask how to ignore this limitation — “pad should be smaller than half of kernel size”.