addition of 2 pytorch tensors with diffrent size
I have 2 tensors with dimension, A = [64,155,300] and B =[64,155,100]
when I add this 2 tensors ie. C= A+B, 
I get this error ==> " RuntimeError: The size of tensor a (300) must match the size of tensor b (100) at non-singleton dimension 2 "

could anyone please help how should I add above tensors? any help will be appreciated!

As error says you can not add two tensor with mis-match shapes
but if you want you can repeat your third dim of B tensor so it can match with A
using torch.Tensor.repeat try A + B.repeat(1,1,3)

&gt;&gt;&gt; A.shape
torch.Size([64, 155, 300])

&gt;&gt;&gt; B.shape
torch.Size([64, 155, 100])

&gt;&gt;&gt; B = B.repeat(1,1,3)

&gt;&gt;&gt; B.shape
torch.Size([64, 155, 300])

&gt;&gt;&gt; C = A + B

&gt;&gt;&gt; C.shape
torch.Size([64, 155, 300])

