If I want a network’s parameters, I can easily throw them into a list using
params = list(network.parameters())
Is there an easy way to do this for the gradients of the network parameters? I know each gradient can be accessed using grad = param.grad
, but storing all these gradients in an array requires me to iterate over each parameter in the network and access its .grad
. Any help is appreciated here!