That’s wrong as explained before.
It should have the shape [batch_size] and contain values in the range [0, nb_classes-1].
If you are dealing with two classes and are using a one-hot encoded tensor, use target = torch.argmax(target, dim=1) before passing it to the loss function.