Thank you for your reply! I appreciate it. It turns out I just forgot to include loss.backward() in the above post, but it is present in my actual code (which still does not update the parameter )
While at first this is frustrating, I think it may actually be helpful in the long run, because I’m able to narrow down the true source of the bug – it’s probably somewhere in the homebrew classifier that I’m importing. I’ll have to take a more indepth look at that code and see if I can’t track down what I’m doing wrong there.
Your response clarified a lot about the overall hierarchy/structure of PyTorch for me, so again, thank you. I’m excited to keep learning and experimenting with the framework, it seems so powerful and has so many possibilities.
One additional question – if I import a model I’ve pretrained using load_state_dict, and then use that model as a part of the calculation of the cost, the parameters of the model won’t be trained, because they aren’t being passed to the optimizer, right? If I understand correctly, an optimizer can only modify the parameters directly passed to it?
Cheers,
Kai