I would like to know, for a multi class classification task, if it is required to pass labels’ dtype as ‘int’. If yes, what doesn’t it signify?
For a multi-class classification task, one would typically use
CrossEntropyLoss as the loss criterion. In recent versions of pytorch,
CrossEntropyLoss supports two types of labels.
Let’s say that your prediction (the
input passed to
[nBatch, nClass]. Then the labels (the
target) can be
either integer categorical class labels of shape
[nBatch] and type
torch.int64 (which is
long) (but not type
torch.int32, which is
Or they can be “soft” probabilistic labels of shape
and of the floating-point type that matches the type of