Let’s say I have two tensors
A = [[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]]
B = [[1, 1, 1, 1],
[2, 2, 2, 2],
[3, 3, 3, 3]]
In addition to that, I have index tensor
Indices = [True, False, True]
So I want to put B[0] at A[0], and B[2] at A[2], but not B[1] because it is False.
C = [[1, 1, 1, 1],
[0, 0, 0, 0],
[3, 3, 3, 3]]
What would be the good API to achieve this function? I have tried scatter, index_fill, but I am not able to achieve that kind of usage. I understand this can be easily achieved by using iterative method, but I wonder can I achieve this from a vectorized way.