I was trying to multiply two tensors A - shape [torch.Size([1100, 4, 3])]
with B - shape [torch.Size([1100])]
.
I would like to do this:
A[0]
-->
tensor([[ 2.0025, -1.8551, -0.5907],
[ 2.0805, 1.8512, -0.5358],
[-1.9438, -2.0552, -0.5612],
[-2.0561, 2.0529, -0.7012]], dtype=torch.float64)
B[0]
-->
tensor(1.4853, dtype=torch.float64)
B[0] * A[0]
-->
tensor([[ 2.9742, -2.7553, -0.8773],
[ 3.0902, 2.7496, -0.7958],
[-2.8871, -3.0525, -0.8335],
[-3.0538, 3.0491, -1.0415]], dtype=torch.float64)
Works if I choose some index, like above. But will not work if I use whole tensors. B * A
,
Error:
RuntimeError: The size of tensor a (1100) must match the size of tensor b (3) at non-singleton dimension 2
Not sure where I am missing?