Hey,
I may be mistaken, but it seems that there is a mistake in the documentation of the loss function NLLLoss
in this page:
http://pytorch.org/docs/master/nn.html#nllloss
According to the given explanations for the variables l_n
, it seems that in the case where reduce
is true
, the weight is applied twice for each target loss. Indeed, by using the variables l_n
defined in the case where reduce
is false
, the weight w_{y_n}
is already applied as factor to x_n_{y_n}
.