I’m not sure to understand the use case completely.
If you want to restore the optimizer, you could store its state_dict and load it afterwards.
To get the id of a parameter, you could use print(id(model.layer.weight)), however I’m not sure what you would like to do with it.