Appending Torch arrays having one similar dimension

Hi There! I would like to know how it can be possible to get a Tensor T of size [x,y,z] , given two tensors T1 [x,y] and T2 [x,z]. Thank you in advance :slight_smile: !

I don’t think it would be possible to concatenate or stack these tensors to the desired shape, since the number of elements differ.
E.g.:

x, y, z = 2, 3, 4
print(x*y*z)
> 24
print((x*y) + (x*z))
> 14

You could transform each tensor to T by adding the missing dimension (via unsqueeze) and then e.g. calling expand or repeat on it.