Thank you or the explanation of state_dict.
However, I found this thread Understanding load_state_dict() effect on computational graph 6 where they explained that my solution is not the good one. But I do not understand how to use nn.functional interface to change the parameters w.r.t which the gradients will be computed during the backward pass.
Can you help me ?