Solved by ptrblck in post #2 
              
              
                The output layer should have the number of classes as out_features. 
Currently your output layer only returns one neuron, which corresponds to class0. 
For a binary use case, this should work: 
batch_size = 5
nb_classes = 2
in_features = 10

model = nn.Linear(in_features, nb_classes)
criterion = nn.…