If you want to classify each sample to one of your 5 classes, try to use nn.CrossEntropyLoss.
Also, shift the target values to [0, nb_classes-1], so [0, 4] in your case, as otherwise you’ll get an out of bounds error.