MultiStepStateScheduler#
- class ignite.handlers.state_param_scheduler.MultiStepStateScheduler(initial_value, gamma, milestones, param_name, save_history=False)[source]#
Update a parameter during training by using a multi step function. The function decays the parameter value by gamma once the number of steps reaches one of the milestones. Based on MultiStepLR from PyTorch. https://pytorch.org/docs/stable/generated/torch.optim.lr_scheduler.MultiStepLR.html
- Parameters
initial_value (float) – Starting value of the parameter.
gamma (float) – Multiplicative factor of parameter value decay.
milestones (List[int]) – List of step indices. Must be increasing.
param_name (str) – name of parameter to update.
save_history (bool) – whether to log the parameter values to engine.state.param_history, (default=False).
Examples
... engine = Engine(train_step) param_scheduler = MultiStepStateScheduler( param_name="param", initial_value=10, gamma=0.99, milestones=[3, 6], ) param_scheduler.attach(engine, Events.EPOCH_COMPLETED) # basic handler to print scheduled state parameter engine.add_event_handler(Events.EPOCH_COMPLETED, lambda _ : print(engine.state.param)) engine.run([0] * 8, max_epochs=10)
New in version 0.4.7.
Methods
Method to get current parameter values