ndwork
(Nicholas Dwork)
1
I have a network (an nn.module) that I’ve defined, run on a set of inputs, and called the member function backward().
I would like access to the values of the gradients. It’d be great, for example, if I could have a dictionary with the values of the gradient.
How can I get this gradient?
jpeg729
(jpeg729)
2
If you model contains a parameter named model.param
then you can access the gradients with respect to that parameter using model.param.grad
.
1 Like
lelouedec
(Lelouedec)
3
you can add hooks to your members and when doing backward add the gradients to a dictionary of your members.