Solved by chenjesu in post #2 
              
              
                Here is an example: 
import torch

img = torch.zeros((128,3,200,100))

padded_image = torch.nn.functional.pad(img, (1,0,1,0), mode='replicate')
conv = torch.nn.Conv2d(3, 64, (2,2), stride=(1,1))
mp = torch.nn.MaxPool2d((2,1))

z = mp(conv(padded_image))

print(z.shape)

In this case we pad the image…