Hi Hongnan!



 Hongnan_G:

CrossEntropyLoss in general don’t expect targets to be of one-hot encoded,


Possibly relevant to your issue:
As of version 1.10, CrossEntropyLoss supports probabilistic targets (in
addition to integer-class-label targets).  One-hot-encoded targets can be
understood as a special case of probabilistic targets.  Earlier versions did
not support probabilistic targets (and hence not one-hot-encoded targets).
If you are seeing your issue with an earlier version, you might try upgrading
to the latest stable version, 1.10.1.
Best.
K. Frank