This error is raised, if (some) model parameters are still on the CPU while the input is on the GPU.
If you’ve registered all parameters and buffers as nn.Parameter or self.register_buffer, the model.to('cuda') operation should move them to the GPU.