you would want to keep the Parameters the same thing after you instantiated the optimizer.
if what you want is “set the parameter to something”, try with torch.no_grad(): layer.weight.copy_(value 1). This copies the value 1 to the parameter rather than replacing the parameter with a completely unrelated one the optimizer doesn’t know anything about.

Would that make sense?
Best regards
Thomas