I wanted to save my model while training every few epochs and was wondering about the best way to go about it. The approach suggested in this link 4 seems to be a common/popular way to do so.
However, I don’t fully understand how the above method works. By calling model.cpu and then model.cuda won’t we be creating new objects for the parameters different from the ones before calling either of the two functions as suggested in the docs? If this is true, then won’t we need to change the parameters the optimizer updates? I’ve not seen this being mentioned anywhere though.
I’m just getting started with PyTorch and so I apologize for any ignorance on my part.