Your train_loss
seems to be a plain float
(i.e. not a tensor
) so make sure you are calling backward
on the actual loss tensor not the Python float
scalar.
2 Likes
Your train_loss
seems to be a plain float
(i.e. not a tensor
) so make sure you are calling backward
on the actual loss tensor not the Python float
scalar.