There’s probably a simple way to do this, but owing to my noobness I do not know who to do this in PyTorch.
Basically, let’s say I have a torch tensor like so:
m = Variable(torch.randn(4,2))
Furthermore, I have a bunch of indices, given by inds, where inds is:
inds Variable containing 1 1 0 0 [torch.LongTensor of size 4]
What I would like to do, is use the elements of inds, to index into the columns of m1. So I would like to get back a 4x1 vector, composed of m[0,1], m[1,1], m[2,0], m[3,0]
How can I do that?