I am new to the NN and PyTorch, so some things are not obvious to me. I would really appreciate help here. I wanted to use nn.CrossEntropyLoss on a tensor of shape [3, 14, 136], where 3 is a batch_size, 14 is sequence_length and 136 is number of tokens. It is one-hotted by number_of_tokens dimension.
I put this tensor into the nn.CrossEntropyLoss with the reference tensor of shape [3, 14] with correct tokens index in second dimension. However I’ve got an error:
ValueError: Expected target size (3, 136), got torch.Size([3, 14])
As I thought from the documentation, my dimensions were correct, what do I do wrong to receive this error?