class_docstr: An abstract class for updating an engine state parameter values during training.
  
  Args:
      param_name: name of parameter to update.
      save_history: whether to log the parameter values to ``engine.state.param_history``, (default=False).
      create_new: whether to create ``param_name`` on ``engine.state`` taking into account whether ``param_name``
          attribute already exists or not. Overrides existing attribute by default, (default=False).
  
  Note:
      Parameter scheduler works independently of the internal state of the attached engine.
      More precisely, whatever the state of the engine (newly created or used by another scheduler) the scheduler
      sets defined absolute values.
  
  .. versionadded:: 0.4.7
class_docstr_tok: ["An","abstract","class","for","updating","an","engine","state","parameter","values","during","training",".","Args",":","param_name",":","name","of","parameter","to","update",".","save_history",":","whether","to","log","the","parameter","values","to","``","engine.state.param_history","``",",","(","default=False",")",".","create_new",":","whether","to","create","``","param_name","``","on","``","engine.state","``","taking","into","account","whether","``","param_name","``","attribute","already","exists","or","not",".","Overrides","existing","attribute","by","default",",","(","default=False",")",".","Note",":","Parameter","scheduler","works","independently","of","the","internal","state","of","the","attached","engine",".","More","precisely",",","whatever","the","state","of","the","engine","(","newly","created","or","used","by","another","scheduler",")","the","scheduler","sets","defined","absolute","values",".","..","versionadded",":",":","0.4.7"]
docstr: Attach the handler to the engine. Once the handler is attached, the ``Engine.state`` will have a new
  attribute with the name ``param_name``. Then the current value of the parameter can be retrieved from
  ``Engine.state`` when the engine is running.
  
  Args:
      engine: trainer to which the handler will be attached.
      event: trigger ``param_name`` value update.
docstr_tok: ["Attach","the","handler","to","the","engine",".","Once","the","handler","is","attached",",","the","``","Engine.state","``","will","have","a","new","attribute","with","the","name","``","param_name","``",".","Then","the","current","value","of","the","parameter","can","be","retrieved","from","``","Engine.state","``","when","the","engine","is","running",".","Args",":","engine",":","trainer","to","which","the","handler","will","be","attached",".","event",":","trigger","``","param_name","``","value","update","."]
code: def attach(
      self,
      engine: Engine,
      event: Union[
          str, Events, CallableEventWithFilter, EventsList
      ] = Events.ITERATION_COMPLETED,
  ) -> None:
      """Attach the handler to the engine. Once the handler is attached, the ``Engine.state`` will have a new
      attribute with the name ``param_name``. Then the current value of the parameter can be retrieved from
      ``Engine.state`` when the engine is running.
  
      Args:
          engine: trainer to which the handler will be attached.
          event: trigger ``param_name`` value update.
  
      """
      if hasattr(engine.state, self.param_name):
          if self.create_new:
              raise ValueError(
                  f"Attribute '{self.param_name}' already exists in the engine.state. "
                  f"This may be a conflict between multiple handlers. "
                  f"Please choose another name."
              )
      else:
          if not self.create_new:
              warnings.warn(
                  f"Attribute '{self.param_name}' is not defined in the engine.state. "
                  f"{type(self).__name__} will create it. Remove this warning by setting create_new=True."
              )
          setattr(engine.state, self.param_name, None)
  
      if self.save_history:
          if (
              not hasattr(engine.state, "param_history")
              or engine.state.param_history is None
          ):
              setattr(engine.state, "param_history", {})
          engine.state.param_history.setdefault(self.param_name, [])  # type: ignore[attr-defined]
  
      engine.add_event_handler(event, self)
  
imports: import numbers
  import warnings
  from bisect import bisect_right
  from typing import Any, List, Sequence, Tuple, Union
  from ignite.engine import CallableEventWithFilter, Engine, Events, EventsList
  from ignite.handlers.param_scheduler import BaseParamScheduler
label_desc: Use image node_id 2 for calling the StateParamScheduler obj's underlying member method code with example usage: obj.attach(engine, event) without return types