nn.CrossEntropyLoss
uses the target to index the logits in your model’s output.
Thus it is suitable for multi-class classification use cases (only one valid class in the target).
nn.BCEWithLogitsLoss
on the other hand treats each output independently and is suitable for multi-label classification use cases.