This is more a pytorch
question. The official torch doc shows that model.to
is called after model.load_state_dict
as follows:
device = torch.device("cuda")
model = TheModelClass(*args, **kwargs)
model.load_state_dict(torch.load(PATH))
model.to(device)
However, the fastai learner
first calls model.to
in def __post_init__()
and then calls load_state_dict
in def load()
.
So is it correct understanding that the order of calling model.to
and load_state_dict
doesn’t matter? Thank you.