I have a dataset of wheat Crop n which i have two clases Ear and Spikelet. when i use crossEntropyLoss function i will get the following error.

image1600×419 21.7 KB

when i change
target_var = Variable(target.float())
to
target_var = Variable(target.long())
i will get the following error

image1547×412 21.3 KB