Hello all,
I need to delete a parameter group from my optimizer.
Here it is a sample code to show what I am doing to tackle the problem:
lstm = torch.nn.LSTM(3,10)
optim = torch.optim.Adam(lstm.parameters())

# train a bit and then delete the parameters from the optimizer
# in order not to train them anymore 
del optim.param_group[0] # optim.param_group = []

# create a new LSTM and train it instead of the old one
new_lstm = torch.nn.LSTM(3,10)
optim.add_param_group(
    {'params' : [p for p in new_lstm.parameters()]}
)

Is there an official PyTorch way to delete parameters group or do I have to use del?