Solved by KFrank in post #2 
              
              
                Hello Mainul! 

When using CrossEntropyLoss (weight = sc) with class weights 
to perform the default reduction = 'mean', the average loss that 
is calculated is the weighted average.  That is, you should be dividing 
by the sum of the weights used for the samples, rather than by the 
number of sampl…