.set_param()
Set a hyperparameter value for one or all parameter groups.
This is the general-purpose setter for any hyperparameter stored in
param_groups (e.g. "lr", "momentum", "beta_1").
When updating "lr" across all groups, self.lr is also kept in
sync for scheduler compatibility.
Parameters:
-
key(str) –Name of the hyperparameter to update (e.g.
"lr"). -
value–New value to assign.
-
group(str | None, default:None) –Label of the group to update. If None, all groups are updated.
Raises:
-
KeyError–If
keydoes not exist in the targeted group(s).