Here’s the code it calls:
On CPU: https://github.com/pytorch/pytorch/blob/master/torch/lib/THNN/generic/ClassNLLCriterion.c 105
On GPU: https://github.com/pytorch/pytorch/blob/master/torch/lib/THCUNN/generic/ClassNLLCriterion.cu 71