Suppose I have a list of indices:
ind = torch.tensor([0, 2, 1, 3]), and a 4x4 tensor
I need to assign some values to the items
A[i, ind[i], for
i=1,4. For example:
for i in range(4): A[i, ind[i]] = r[i]
r contains the target values in this example.
r, Is there a way to vectorize this operation?