As far as I can see. This is nothing to do with to() method. In general, pytorch expects both the model and the input data to be of the same data type i.e float in our case. And if you are using GPU both the model weight and the input should be moved to gpu. Else the error mentioned will occur. As the first step check for the architecture class.