Solved by ptrblck in post #2 
              
              
                The code looks generally alright. The output should contain raw logits, not probabilities for the nn.CrossEntropyLoss, but I assume you just used these values for easier debugging. 
If you are concerned about the indexing, you could just use separate target tensors (and potentially different output …