The formula for output height and width is given in the docs: http://pytorch.org/docs/0.3.0/nn.html#torch.nn.ConvTranspose2d 410
So you can infer the amount of padding needed to make sure you get to your output size:
http://pytorch.org/docs/0.3.0/nn.html#torch.nn.ConvTranspose2d 410

Screen Shot 2018-01-11 at 7.53.35 AM.png1396×238 36.3 KB