Hi there, i would like to get a linear combination of a matrix rows weighted by scalars on other matrix row. My setup is the following
S: Tensor B x M x N
W: Tensor B x M x M

Now suppose S[0] = [[1,2,1,0],[-1,3,0,2],[1,2,2,-1]] and
W[0] = [[0.2,0.3,0.5], [0.1,0.1,0.8], [0.2,0.2,0.6]]. What i want to get is a matrix with entries
a = 0.2[1,2,1,0] + 0.3[-1,3,0,2] + 0.5[1,2,2,-1] = [0.4, 2.3, 1.2, 0.1]
b = 0.1[1,2,1,0] + 0.1[-1,3,0,2] + 0.8[1,2,2,-1] = [0.8, 2.1, 1.7, -0.6]
c = 0.2[1,2,1,0] + 0.2[-1,3,0,2] + 0.6[1,2,2,-1] = [0.6, 2.2, 1.4, -0.2]

And that’s for each pair of chanels S[i], W[i]. I came up with a solution but implies repeat and view  several times and it looks super ugly to me. Any help is welcome! Ty