What is your number of classes and what do the dimensions of the output represent?
Are you working on a multi-class classification, where each temp. step would correspond to a single class?
If so, nn.CrossEntropyLoss expects the model output to have the shape [batch_size, nb_classes, seq_len] and the target as [batch_size, seq_len] containing the class indices in the range [0, nb_classes-1].