Ah OK, in that case remove the nn.Sigmoid and pass the raw logits in the shape [batch_size, nb_classes] to nn.CrossEntropyLoss. The targets should have the shape [batch_size] and contain class indices in the range [0, nb_classes-1]. To get the predicted class from the model output use preds = torch.argmax(output, dim=1).