The input data and parameters of a module need to be located on the same GPU, since the calculation is performed on this device.
In your current code it seems your input is on GPU0, while the weight parameter is on GPU2.
Make sure to push the input to the same device where the model is located.