Suppose I have a 2-d tensor:
t
tensor([[1.0000, 3.0000, 4.0000, 2.0000, 1.0000],
        [2.0000, 3.0000, 3.5000, 4.0000, 3.5000]])

and a LongTensor:
c
tensor([2, 3])

I want to get the first c[i] elements’ sum of the i-th row of t, i.e. [4.0, 8.5] in this case. How to calculate this without iteration?