Thanks for correcting my mistake.



 ptrblck:

need to make sure the tensors and parameters are on the appropriate device.


All tensors and parameters need to be on the same device before calling w.backward().
Is this your point?