If you are looking for label smoothing, this thread 89 might have an interesting code snippet.
Alternatively, you could just write out the formula.
I’m not sure, how p_o,c is defined, but I guess it should be the probability of class c for output o?
-1. * (target * F.log_softmax(x, 1)[target]).sum()