Solved by ptrblck in post #2 
              
              
                A manual (and slow) implementation can be found here and the CPU implementation calls into cross_entropy_loss and then into nll_loss.