Is `map_location` in `torch.load()` and `model.load_state_dict()` independent from `device` in `.to()`?

Hi,

The map_location changes the device of the Tensors in the state dict that is returned.
But when you load_state_dict(), then these values are loaded (and only values) into the model. But that does not change the model’s device! you will need to move the model itself with .to() if you want to have it on a different device.

2 Likes