Using CrossEntropyLoss instead of BCELoss

Hello, I have a dataset of text and labels and I want to do multiclass classification. I have 5 classes. I follow this toturial: Text Classification Pytorch | Build Text Classification Model
But I needed to change the loss function to be:CrossEntropyLoss

        loss = criterion(predictions, batch.Rating)        

this error keeps showing:

IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)

Could you please help me with how can I call this loss function?

nn.CrossEntropyLoss expects a model output in the shape [batch_size, nb_classes] and a target in [batch_size] containing class indices in the range [0, nb_classes-1] for a multi-class classification.
Based on the error message I guess your target has an additional dimension, which should be removed.

Thanks, it works fine now