Not in the case of nn.CrossEntropyLoss or nn.NLLLoss (which are equivalent).
If you have a look at the formula 5 to calculate the loss, you’ll see that only the current class index is needed to get the corresponding log probability. I guess other frameworks convert the one-hot encoded vector to an index representation for this reason (or just multiply with the one-hot vector).