NLLLoss
class torch.nn.NLLLoss(weight=None, size_average=None, ignore_index=- 100, reduce=None, reduction='mean')
The negative log likelihood loss. It is useful to train a
   classification problem with C classes.
If provided, the optional argument "weight" should be a 1D Tensor
   assigning weight to each of the classes. This is particularly
   useful when you have an unbalanced training set.
The input given through a forward call is expected to contain
   log-probabilities of each class. input has to be a Tensor of size
   either (minibatch, C) or (minibatch, C, d_1, d_2, ..., d_K) with K
   \geq 1 for the K-dimensional case. The latter is useful for
   higher dimension inputs, such as computing NLL loss per-pixel for
   2D images.
Obtaining log-probabilities in a neural network is easily achieved
   by adding a  LogSoftmax  layer in the last layer of your network.
   You may use CrossEntropyLoss instead, if you prefer not to add an
   extra layer.