Selection/Filter with indices using pytorch
I have a 3-dimensional numpy array, for example:

 x = [[[0.3, 0.2, 0.5],
       [0.1, 0.2, 0.7],
       [0.2, 0.2, 0.6]]]


The indices array is also 3-dimensional, like:

indices = [[[0],
            [1],
            [2]]]


I expect the output is:

 output= [[[0.3],
           [0.2],
           [0.6]]]


I tried the torch.index_select and torch.gather function, but I couldn't find a right way to deal with the dimension. Thanks for any help!

How about using x.gather(dim=2, indices)? That works for me. 
