Hi!
I have a 4D tensor A with shape (B, X, Y, Z) and a tensor B with shape (N, 4), each of whose rows stores the index of one element of tensor A.
For example:
B = torch.Tensor([[0, 0, 0, 0], [0, 0, 0, 1]])
# I want to access tensor A:
A[0, 0, 0, 0] = 1
A[0, 0, 0, 1] = 1
How can I access tensor A using tensor B without for loop? I find it difficult to use scatter, index_select, and index_put.
Thank you!