Solved by ptrblck in post #3 
              
              
                As Chetan explained, the model output tensor should contain the class indices in dim1 and additional dimensions afterwards. 
Generally, nn.CrossEntropyLoss expects these shapes: 

output: [batch_size, nb_classes, *]

target [batch_size, *]