I have a similar task, so maybe someone can help me!
So what I have are two tensors:

an indices tensor indices with shape (2, 5, 2), where the last dimensions corresponds to indices in x and y dimension
a “value tensor” value with shape (2, 5, 2, 16, 16), where I want the last two dimensions to be selected with x and y indices

To be more concrete, the indices are between 0 and 15 and I want to get an output:
out = value[:, :, :, x_indices, y_indices]

For example the indices for the first item are i_y = indices[0, 0, 0]; i_x = indices[0, 0, 1]. The corresponding output should then be out[0, 0, :, i_y, i_x]. Can anybody help me here? Thanks a lot!