Concatenate 3D tensors

Variable 1 size = (100L, 13L, 200L)
Variable 2 size = (100L, 1L, 200L)

Both are Variable(FloatTensors) of type (Batch_sizesequence_lengthnumber_of_features)

I want to append the 1200 dimension matrix of Variable 2 to the 13200 matrix of Variable 1, to obtain a 13*400 matrix.
This is to be done for every element(100 total here), in the batch.

Is this possible using a direct torch.cat/stack call? I tried cat with dimension value 2, but it gave an inconsistent tensor error.

it should be torch.cat with dimension value 1 (python is 0-indexed, so second dim = 1)

1 Like