Solved by ptrblck in post #3 
              
              
                You could use F.pad from nn.functional: 
a = torch.randn(1, 3, 6, 8)
p2d = (1, 1, 2, 2) # pad last dim by (1, 1) and 2nd to last by (2, 2)
F.pad(a, p2d, 'constant', 0)
>> [torch.FloatTensor of size 1x3x10x10]