For example, I use numpy:

2017-12-05-170222_544x733_scrot.png544×733 41.1 KB

Then I would like to do it in PyTorch, but it failed, I do not know how to solve it.

2017-12-05-170351_1042x765_scrot.png1042×765 47 KB

I know this is duplicated with How to get a matrix top-n in its second axis? 1 However, topk still does not meet my real need that I wand to use b to index another variablec too. For example:

@tom Hello, could you answer this question too? thank you!