Hi, I face the same problem as Naveen,  shape of my output is torch.Size([1, 20, 4]), where 20 is the time sequence, 4 is the number of classes, softmax was used as the final activitation function, and loss is nn.CrossEntropyLoss(), I use the follow expression:
loss = loss_func(output, torch.max(label, 2)[1])
I got this error:
ValueError: Expected target size (2, 4), got torch.Size([2, 20])
But if I changed my time sequence to 4, this error disappeared, why？