moreshud:

I read posts relating to Crossentroy with the label, not one-encoded, but in my case, the label per channel are either one or zero.


As you said, nn.CrossEntropyLoss doesn’t accept one-hot encoded targets, which seems to be the case in your workflow. Pass either class indices or use e.g. nn.BCEWithLogitsLoss, if you are dealing with a multi-label classification.