code: def check_model_and_optimizer(
      self, reset_optimizer_state=False, **kwargs
  ):
      # If strategy has access to the task boundaries, and the current
      # sub-experience is the first sub-experience in the online stream,
      # then adapt the model with the full origin experience:
      assert self.experience is not None
  
      if self.optimized_param_id is None:
          self.make_optimizer(reset_optimizer_state=True, **kwargs)
  
      if _at_task_boundary(self.experience, before=True):
          self.model = self.model_adaptation()
          self.make_optimizer(
              reset_optimizer_state=reset_optimizer_state, **kwargs
          )
  
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 4 for calling the BatchObservation obj's underlying member method code with example usage: obj.check_model_and_optimizer(reset_optimizer_state) without return types