Solved by ptrblck in post #2 
              
              
                Usually you would like to normalize the probabilities (log probabilities) in the feature dimension (dim1) and treat the samples in the batch independently (dim0). 
If you apply F.softmax(logits, dim=1), the probabilities for each sample will sum to 1: 
# 4 samples, 2 output classes
logits = torch.ra…