Extract weights from LSTM / GRU cells

How can I access and extract weights from all cells in a LSTM / GRU layer?

1 Like

In general, you can always do list(r.parameters()), to get all the parameters of any model r.

1 Like

A better alternative would be list(r.named_parameters()). This would give you a dict kind of structure