I strongly appeal to support this Feature request: NLLLoss / CrossEntropyLoss
that accepts one-hot vector target! Don’t know what’s the situation now?!
From current docs of CrossEntropyLoss / NLLLoss
(http://pytorch.org/docs/master/nn.html?highlight=nllloss#torch.nn.NLLLoss 137),
it’s hard to understand or interpret CrossEntropyLoss or NLLLoss as a loss function!
From mathematical point of view, a loss function loss(x,y) = 0 if and only if x=y.
For example, torch.nn.MSELoss satisfies such condition. It’s natural to introduce
one-hot vector target in CrossEntropyLoss such that it meets the above condition
(with help of x*log(x) -> 0 as x -> 0). In addition, one-hot vector is a special discrete
probability distribution. Tensorfollow has the one-hot vector in its loss function implement.
Torch should have this feature too!