nn.CrossEntropyLoss can be used with a target containing class indices and starting from the latest release also accepts targets containing probabilities.
In the former case the model output should have the shape [batch_size, nb_classes] containing logits and the targets [batch_size] containing class indices in the range [0, nb_classes-1].
One-hot encoded targets could be seen as a probability, and should be accepted now, too.