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])