CrossEntropy Loss accepting labels as one hot

Hi

Is there a way to calculate loss using the one hot vectors and not just the indexes?
Instead of sending 5 as target I’d like to send [0,0,0,0,0,1,0,0,0,0] for example

I think the reason they force the target to be an index is to avoid target vectors that would have no sens, like a vector with more than one positive value.

If you have targets in the ``hot" form, you can use

criterion(output, target.max(0)[1])