docstr: Optimizer initialization.
  
  Called before each training experience to configure the optimizer.
  
  :param reset_optimizer_state: bool, whether to reset the
      state of the optimizer, defaults to False
  
  Warnings:
      - The first time this function is called
        for a given strategy it will reset the
        optimizer to gather the (name, param)
        correspondance of the optimized parameters
        all the model parameters will be put in the
        optimizer, regardless of what parameters are
        initially put in the optimizer.
docstr_tok: ["Optimizer","initialization",".","Called","before","each","training","experience","to","configure","the","optimizer",".",":","param","reset_optimizer_state",":","bool",",","whether","to","reset","the","state","of","the","optimizer",",","defaults","to","False","Warnings",":","-","The","first","time","this","function","is","called","for","a","given","strategy","it","will","reset","the","optimizer","to","gather","the","(","name",",","param",")","correspondance","of","the","optimized","parameters","all","the","model","parameters","will","be","put","in","the","optimizer",",","regardless","of","what","parameters","are","initially","put","in","the","optimizer","."]
code: def make_optimizer(self, reset_optimizer_state=False, **kwargs):
      """Optimizer initialization.
  
      Called before each training experience to configure the optimizer.
  
      :param reset_optimizer_state: bool, whether to reset the
          state of the optimizer, defaults to False
  
      Warnings:
          - The first time this function is called
            for a given strategy it will reset the
            optimizer to gather the (name, param)
            correspondance of the optimized parameters
            all the model parameters will be put in the
            optimizer, regardless of what parameters are
            initially put in the optimizer.
      """
      if self.optimized_param_id is None:
          self.optimized_param_id = reset_optimizer(
              self.optimizer, self.model
          )
      else:
          self.optimized_param_id = update_optimizer(
              self.optimizer,
              dict(self.model.named_parameters()),
              self.optimized_param_id,
              reset_state=reset_optimizer_state,
          )
  
file_path: avalanche/avalanche/training/templates/observation_type/batch_observation.py
imports: import warnings
  from collections import defaultdict
  from typing import List, TypeVar
  from torch import Tensor
  from avalanche.benchmarks import OnlineCLExperience
  from avalanche.models.utils import avalanche_model_adaptation
  from avalanche.training.templates.strategy_mixin_protocol import SGDStrategyProtocol
  from avalanche.models.dynamic_optimizers import reset_optimizer, update_optimizer
  from avalanche.training.utils import _at_task_boundary
label_desc: Use image node_id 3 for calling the BatchObservation obj's underlying member method code with example usage: obj.make_optimizer(reset_optimizer_state) without return types