legacy/nn/JoinTable.py RuntimeError: inconsistent tensor size

Hello,

When running the layer legacy/nn/JoinTable.py I get:

/usr/local/lib/python3.5/dist-packages/torch/legacy/nn/JoinTable.py in updateOutput(self, input)
     35         for i in range(len(input)):
     36             currentOutput = input[i]
---> 37             self.output.narrow(dim, offset, currentOutput.size(dim)).copy_(currentOutput)
     38             offset += currentOutput.size(dim)
     39 

RuntimeError: inconsistent tensor size, expected tensor [3 x 480 x 240] and src [3 x 480 x 480] to have the same number of elements, but got 345600 and 691200 elements respectively at /pytorch/torch/lib/TH/generic/THTensorCopy.c:86

Any idea how to solve it?

Thanks,

It sounds like it doesn’t support broadcasting? You can do tensor.repeat(1, 1, 2) to the first tensor to have it match the second tensor’s size.