According to the docs, if reduce is false: l_n = - w_yn*x_n,yn. If reduce is true this is multiplied by reciprocal sum of weights.

Hence weights do not need to add to 1. However docs for the new ‘reduction’ state: ‘mean’: the sum of the output will be divided by the number of elements in the output.

So do the weights have to add to 1?

In general, do the weights passed to cross-entropy loss or NLLLoss have to add to 1?