I am working on a project where I need to multiply 2 tensors which look like this. The first tensor has 5 matrices and the second one has 5 column vectors. I need to multiply these two to get the resultant tensor such that each element of that tensor is the column vector I get after multiplying the corresponding matrix by the corresponding column vector. `
tensor([[[8.1776, 0.6560],
[0.6560, 2.3653]],
[[8.1776, 0.6560],
[0.6560, 2.3104]],
[[8.9871, 0.6560],
[0.6560, 2.2535]],
[[1.3231, 0.6560],
[0.6560, 2.3331]],
[[4.8677, 0.6560],
[0.6560, 2.2935]]], grad_fn=<AddBackward0>)
tensor([[-0.1836, -0.9153],
[-0.1836, -0.8057],
[-0.2288, -0.6442],
[ 0.1017, -0.8555],
[-0.0175, -0.7637]], grad_fn=<AddBackward0>)
` I simple @ or * does not work. What should I do? I need to call backward and hence cannot lose the gradients.
I tried other functions like @ or * and looked up some docs like torch.split but none of them really worked.