ConvTranspose3d doesn't seem to accept a 5D output_size (this works with a 4D output_size and ConvTranspose2d), I think due to the following lines in nn/modules/conv.py (the output_size[-2:] forces output_size to be 2D, but k is 3 in case of 3D).
k = input.dim() - 2
if len(output_size) == k + 2:
output_size = output_size[-2:]
if len(output_size) != k:
raise ValueError(
"output_size must have {} or {} elements (got {})"
.format(k, k + 2, len(output_size)))
Below is a minimal example to reproduce this. Using the commented line without the output_size requirement works.
import torch
from torch.autograd import Variable
import torch.nn as nn
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.ConvTranspose3d(10, 10, 3)
def forward(self, x):
return self.conv1(x, output_size=torch.Size((1,10,64,64,64)))
# return self.conv1(x)
net = Net()
input = Variable(torch.randn(1, 10, 64, 64, 64))
out = net(input)
print(out.size())
ConvTranspose3d doesn't seem to accept a 5D output_size (this works with a 4D output_size and ConvTranspose2d), I think due to the following lines in nn/modules/conv.py (the
output_size[-2:]forces output_size to be 2D, but k is 3 in case of 3D).Below is a minimal example to reproduce this. Using the commented line without the output_size requirement works.