Solved by ptrblck in post #2 
              
              
                The ignore_index argument just masks the loss for the current class. 
From the docs: 

ignore_index (int, optional) – Specifies a target value that is ignored and does not contribute to the input gradient. When size_average is True, the loss is averaged over non-ignored targets. 

If you would like …