Solved by ptrblck in post #2 
              
              
                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.