Solved by anantguptadbl in post #2 
              
              
                rnn1 = nn.LSTM(input_size=10, hidden_size=5, num_layers=3)
relevant_parameters = [i for i,(param_name,param_value) in enumerate(list(rnn1.named_parameters())) if 'l2' in param_name]
for i,cur_parameter in enumerate(rnn1.parameters()):
    if i in relevant_parameters:
        print("Setting for {0}".…