When I am using the “model.parameters()” twice, it just work for one time. It is because the type of model.parameters() is a generator. Is there any solution to tackle this issue?
‘’’’’
#working
for param in model.parameters():
par1.append(param.grad.view(-1))
#Not working
for param in model.parameters():
par2.append(param.grad.view(-1))