I assume you are using nn.CrossEntropyLoss or nn.NLLLoss as the criterion.
If so, check the output shape as well as the min. and max. values on targets.
As described before: for a multi-class classification the output should have the shape [batch_size, nb_classes], while the target is expected to have the shape [batch_size] and contain class indices in the range [0, nb_classes-1].