For a multiclass setting you usually use nn.NLLLoss+ nn.LogSoftmax or nn.CrossEntropyLoss with logits as criteria.
Both loss functions need a target tensor containing class indices, not a one-hot encoded matrix.
Have a look at the docs 35 for more information and an example of the usage.