Is there an example for multi class multilabel classification in Pytorch?

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.

8 Likes