I’m having difficulty following exactly what you’re looking for. If you could provide a code snippet that does your indexing in some for loops that would be great.
I think what you’re looking for can be written using http://pytorch.org/docs/0.3.1/torch.html?highlight=gather#torch.gather 4