LambdaStateScheduler#
- class ignite.handlers.state_param_scheduler.LambdaStateScheduler(lambda_obj, param_name, save_history=False)[source]#
- Update a parameter during training by using a user defined callable object.
User defined callable object is taking an event index as input and returns parameter value.
- Parameters
Examples
... engine = Engine(train_step) class LambdaState: def __init__(self, initial_value, gamma): self.initial_value = initial_value self.gamma = gamma def __call__(self, event_index): return self.initial_value * self.gamma ** (event_index % 9) param_scheduler = LambdaStateScheduler( param_name="param", lambda_obj=LambdaState(10, 0.99), ) 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=2)
New in version 0.4.7.
Methods
Method to get current parameter values