Hi,
You can only pass float tensors to calculate gradient using MSELoss. Try to add float() at the end of predicted_y and true_y tensors like below:



 Py_Buddy:

loss = criterion(predicted_y.float(), true_y.float())


The reason is when you use .max() it returns Long or simply integer not float numbers. So you have to cast them before passing to the loss function.
Good luck
Nik