Hi Soumik!



 srdg:

I have a dataset of 21 input features and 1 class label ranging from 0-3.
I simply don’t see how I can have multiple fully-connected layers with the OH-Encoded target list at the end.
…
I would like to know how I can use one-hot encoded labels as my target.


It sounds like you wish to build a four-class classifier.
The most common approach would be to have the final layer of
your model be a Linear layer with four output features (and no
“activation” layer after it, so no final ReLU).
(As it stands, your final Linear layer has only one output feature
so your model is not making predictions for four classes.)
You will likely use CrossEntropyLoss as your loss criterion.
The output of your model will have shape [nBatch, 4] and will be
the input to CrossEntropyLoss.  The target passed to
CrossEntropyLoss will have shape [nBatch] (no class dimension)
and is not one-hot encoded.  Rather, target consists of integer
class labels whose values are in {0, 1, 2,  3}.
So neither the output of your model nor your target will be one-hot
encoded.
Best.
K. Frank