The .to() method needs the device code of the device, for gpus, the code is usually something like “cuda:0”. You can also use .cuda().


Idk what device is data on, but calling .long() only changes it to Long type on its original device. If ur model is on gpu, u also have to change the inputs to gpu. In this case, I guess data is not on gpu.