Thanks Dear @ptrblck . As i said, my target labels are (1,2,3,4,5) stars and my last layer is the linear layer   self.label = nn.Linear(out_channels, output_size)
However, when i don’t use one hot to encode the targets, the following error is thrown.
y_top1=y.topk(1,dim=1)[1]
RuntimeError: Dimension out of range (expected to be in range of [-1, 0], but got 1)
Thank you.