tom:

torch.nn.functional.softmax(score, dim=1)[:, 1]


Thank you so much for your reply, I will have a go with reading your book!
Just one more question, you said torch.nn.functional.softmax(score, dim=1)[:, 1] is same as torch.argmax(score,dim=1), but wouldn’t this always select the second index element no matter of probability of two elements?
Here is an example when I tried your method:
normal softmax:  tensor([[0.0850, 0.9150],
[0.0598, 0.9402],
[0.0765, 0.9235],
…,
[0.6879, 0.3121],
[0.1176, 0.8824],
[0.6816, 0.3184]], device=‘cuda:0’, grad_fn=)
After: tensor([0.9150, 0.9402, 0.9235,  …, 0.3121, 0.8824, 0.3184], device=‘cuda:0’,
grad_fn=)
The tensor after ‘After:’ is the result of using your recommended line(torch.nn.functional.softmax(score, dim=1)[:, 1]) and as you can see it always return the second index element’s probability not an index and no matter of the probabilities between the first and second elements.