jel158:

for p,n in zip(rnn.parameters(),rnn._all_weights[0]):
    if n[:6] == 'weight':
        print('===========\ngradient:{}\n----------\n{}'.format(n,p.grad))



I get error ‘Net’ object has no attribute ‘all_weights’…