_ParamScheduler¶
- class mmengine.optim._ParamScheduler(optimizer, param_name, begin=0, end=1000000000, last_step=-1, by_epoch=True, verbose=False)[源代码]¶
Base class for parameter schedulers.
It should be inherited by all schedulers that schedule parameters in the optimizer’s
param_groups
. All subclasses should overwrite the_get_value()
according to their own schedule strategy. The implementation is motivated by https://github.com/pytorch/pytorch/blob/master/torch/optim/lr_scheduler.py.- 参数:
optimizer (BaseOptimWrapper or Optimizer) – Wrapped optimizer.
param_name (str) – Name of the parameter to be adjusted, such as
lr
,momentum
.begin (int) – Step at which to start updating the parameters. Defaults to 0.
end (int) – Step at which to stop updating the parameters. Defaults to INF.
last_step (int) – The index of last step. Used for resuming without state dict. Default value
-1
means thestep
function is never be called before. Defaults to -1.by_epoch (bool) – Whether the scheduled parameters are updated by epochs. Defaults to True.
verbose (bool) – Whether to print the value for each update. Defaults to False.
- get_last_value()[源代码]¶
Return the last computed value by current scheduler.
- 返回:
A list of the last computed value of the optimizer’s
param_group
.- 返回类型:
- load_state_dict(state_dict)[源代码]¶
Loads the schedulers state.
- 参数:
state_dict (dict) – scheduler state. Should be an object returned from a call to
state_dict()
.