Thank you for replying. I understand that what you have said but I would really appreciate understanding what’s happening in the first piece of code that I wrote.
The model is put onto cuda:0, then it loads a state dict which contains a tensor mapped to cuda:1. So what actually happens in model? What values will it contain after loading the state dict? If a state dict has to be loaded into a model to be useful, what is the use of it having its own device property? And would it be feasible to have a warning when the model and state dict devices do not match?