Most likely you are passing the target tensor in the wrong shape.
For a multi-class classification use case with nn.CrossEntropy, the target should have the shape [batch_size] and contain the class indices in the range [0, nb_classes].