ConvTranspose3d: output_size must have 3 or 5 elements (got 2)

torch version : '0.4.0a0+ba93c03’
possible bug at https://github.com/pytorch/pytorch/blob/master/torch/nn/modules/conv.py#L411?

The below example of ConvTranspose3d gives “output_size must have 3 or 5 elements (got 2)” error.

import torch, torch.nn as nn, torch.autograd as autograd
input = autograd.Variable(torch.randn(1, 16, 12, 12, 12))
downsample = nn.Conv3d(16, 16, 3, stride=2, padding=1)
h = downsample(input)
upsample = nn.ConvTranspose3d(16, 16, 3, stride=2, padding=1)
output = upsample(h, output_size=input.size())

Similar example with ConvTranspose2d works fine.

import torch, torch.nn as nn, torch.autograd as autograd
input = autograd.Variable(torch.randn(1, 16, 12, 12))
downsample = nn.Conv2d(16, 16, 3, stride=2, padding=1)
h = downsample(input)
upsample = nn.ConvTranspose2d(16, 16, 3, stride=2, padding=1)
output = upsample(h, output_size=input.size())

Current Workaround for ConvTranspose3d:

output = upsample(h, output_size=input.size()[-3:])