Replies: 2 comments 1 reply
-
Yes, you are correct. In PyTorch, the optimizer, criterion, and model objects interact in a coordinated manner. If you know the back propagation process of gradient descent, u will get the gist of what it does.
|
Beta Was this translation helpful? Give feedback.
-
Your assumptions are correct. The sharing of gradient and parameter information between the optimizer, criterion, and model happens implicitly in the background through the use of PyTorch's autograd system. Here's a breakdown of how it works:
|
Beta Was this translation helpful? Give feedback.
-
My Question
Just wondering how the information of the gradients is passed between the optimizer, criterion (loss function object) and the model
My code
What I assume
I assume that the optimizer, criterion and model all share a reference to the gradient and the parameters? Since this is not done explicitly (with the exception of the parameters into the optimizer) I assume this is done in the background?
Beta Was this translation helpful? Give feedback.
All reactions