Shortcuts

_ParamScheduler

class mmengine.optim._ParamScheduler(optimizer, param_name, begin=0, end=1000000000, last_step=-1, by_epoch=True, verbose=False)[source]

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.

Parameters:
  • 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 the step 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()[source]

Return the last computed value by current scheduler.

Returns:

A list of the last computed value of the optimizer’s param_group.

Return type:

list

load_state_dict(state_dict)[source]

Loads the schedulers state.

Parameters:

state_dict (dict) – scheduler state. Should be an object returned from a call to state_dict().

print_value(is_verbose, group, value)[source]

Display the current parameter value.

Parameters:
  • is_verbose (bool) – Whether to print the value.

  • group (int) – The index of the current param_group.

  • value (float) – The parameter value.

state_dict()[source]

Returns the state of the scheduler as a dict.

It contains an entry for every variable in self.__dict__ which is not the optimizer.

Returns:

scheduler state.

Return type:

dict

step()[source]

Adjusts the parameter value of each parameter group based on the specified schedule.

Read the Docs v: latest
Versions
latest
stable
v0.10.3
v0.10.2
v0.10.1
v0.10.0
v0.9.1
v0.9.0
v0.8.5
v0.8.4
v0.8.3
v0.8.2
v0.8.1
v0.8.0
v0.7.4
v0.7.3
v0.7.2
v0.7.1
v0.7.0
v0.6.0
v0.5.0
v0.4.0
v0.3.0
v0.2.0
Downloads
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.