I really couldn’t understand this for a long time. I think what Klory is trying to say is this:

If you look at most loss functions (e.g. Cross Entropy Loss 19) you will see that reduction="mean". This means that the loss is calculated for each item in the batch, summed and then divided by the size of the batch.
If you want to compute the standard loss (without the average) you will need to multiply the mean loss outputted by criterion() with the batch size, which is outputs.shape[0].