All right, this worked for me whenever I got error on similar lines (I am gonna keep it here for reference):

When calling your model on input ensure that your x is float.
However keep your target as long.
Call loss on model output and y without any typecasting.

from torch import nn
net = nn.Linear(input, out_classes)
loss_criterion = nn.CrossEntropyLoss()

net = net.to(device)
X = X.to(device).float()
y = y.to(device).long()

y_hat = net(X)
l = loss_criterion(y_hat, y)