Hello Fahad!



 FahadAslamCS:

I have 6 classes denoted by 0, 5,20,40, 2.5, 10


When you use CrossEntropyLoss, your target y that you pass
in to criterion must be integer class labels that take on values
running from 0 to nClass - 1 (in your case, (0, 1, 2, 3, 4, 5)).
If your class labels are originally (0, 5, 20, 40, 2.5, 10), you will
have to remap them before passing them to criterion.
Just to be clear, the shape of y should simply be [nBatch].
Best.
K. Frank