avalanche.models.dynamic_optimizers.update_optimizer(optimizer, new_params, optimized_params, reset_state=False)[source]

Update the optimizer by adding new parameters, removing removed parameters, and adding new parameters to the optimizer, for instance after model has been adapted to a new task. The state of the optimizer can also be reset, it will be reset for the modified parameters.

Newly added parameters are added by default to parameter group 0

  • new_params – Dict (name, param) of new parameters

  • optimized_params – Dict (name, param) of currently optimized parameters (returned by reset_optimizer)

  • reset_state – Wheter to reset the optimizer’s state (i.e momentum). Defaults to False.


Dict (name, param) of optimized parameters