Tensor element wise multiplication, dimension is different

a= tensor ([4,4,3])
b= tensor ([3,3,2])
i think, a*b result tensor([12,12,6])
but, the real result is tensor([[12,12,6]])
maybe, one more dimension.
i want tensor([12,12,6])
how can i get this result?

the result is my mistake.
a is not tensor([4,4,3]), but tensor([[4,4,3]])
so result is tensor([[12,12,6]]).

i get tensor([12,12,6]).

a is not tensor([4,4,3]), but tensor([[4,4,3]])
so result is tensor([[12,12,6]]).
i get tensor([12,12,6]).

That’s slightly confusing. You want to element-wise multiply tensor ([[4,4,3]]) with ([3, 3, 2]) but get a tensor([ 12, 12, 6])?

Just use the view method to drop one dimension. E.g., result = (a * b).view(-1)

thanks for answer.

i mean, i want to get tensor ([12,12,6]).

the .view(-1) approach should work fine for you then