F.nll_loss expects the model output to be log probabilities, so you should use F.log_softmax as your last activation.
Also, the target tensor should contain the class index only (have a look at the docs for an example), while it seems you are passing one-hot encoded targets.
Usually this should raise an Exception, so I’m not sure, why the code runs.
Could you post a minimal code snippet to see, how you are using this criterion and what model you are using?