It seems your target tensor is out of the expected range of [0, n_classes-1]
and it seems you might be using nn.CrossEntropyLoss
.
If that’s the case, note that this loss function expects logits as the model output, so you should remove the sigmoid and just pass the output to the criterion directly.