Can you provide the full error? Also have you tried converting any of the variables to float use .float(). Maybe try doing any of these:
loss = criterion(out, target.float())
# or
loss = criterion(out.float(), target)
# or
loss = criterion(out, target).float()