For a vanilla multi-class classification nn.CrossEntropyLoss expects the model outputs to be a FloatTensor in the shape [batch_size, nb_classes], while the target should be a LongTensor in the shape [batch_size] containing class indices in the range [0, nb_classes-1].