class_docstr: One Cycle LR Scheduler.
  
  The 1cycle learning rate policy changes the learning rate after every
  batch. The one cycle learning rate policy is described in
  https://arxiv.org/pdf/1708.07120.pdf
  
  Args:
      max_lr (float or list): Upper learning rate boundaries in the cycle
          for each parameter group.
      total_steps (int, optional): The total number of steps in the cycle.
          Note that if a value is not provided here, it will be the max_iter
          of runner. Default: None.
      pct_start (float): The percentage of the cycle (in number of steps)
          spent increasing the learning rate.
          Default: 0.3
      anneal_strategy (str): {'cos', 'linear'}
          Specifies the annealing strategy: 'cos' for cosine annealing,
          'linear' for linear annealing.
          Default: 'cos'
      div_factor (float): Determines the initial learning rate via
          initial_lr = max_lr/div_factor
          Default: 25
      final_div_factor (float): Determines the minimum learning rate via
          min_lr = initial_lr/final_div_factor
          Default: 1e4
      three_phase (bool): If three_phase is True, use a third phase of the
          schedule to annihilate the learning rate according to
          final_div_factor instead of modifying the second phase (the first
          two phases will be symmetrical about the step indicated by
          pct_start).
          Default: False
code: def __init__(
      self,
      max_lr,
      total_steps=None,
      pct_start=0.3,
      anneal_strategy="cos",
      div_factor=25,
      final_div_factor=1e4,
      three_phase=False,
      **kwargs,
  ):
      # validate by_epoch, currently only support by_epoch = False
      if "by_epoch" not in kwargs:
          kwargs["by_epoch"] = False
      else:
          assert not kwargs[
              "by_epoch"
          ], 'currently only support "by_epoch" = False'
      if not isinstance(max_lr, (numbers.Number, list, dict)):
          raise ValueError(
              "the type of max_lr must be the one of list or "
              f"dict, but got {type(max_lr)}"
          )
      self._max_lr = max_lr
      if total_steps is not None:
          if not isinstance(total_steps, int):
              raise ValueError(
                  "the type of total_steps must be int, but"
                  f"got {type(total_steps)}"
              )
          self.total_steps = total_steps
      # validate pct_start
      if (
          pct_start < 0
          or pct_start > 1
          or not isinstance(pct_start, float)
      ):
          raise ValueError(
              "expected float between 0 and 1 pct_start, but "
              f"got {pct_start}"
          )
      self.pct_start = pct_start
      # validate anneal_strategy
      if anneal_strategy not in ["cos", "linear"]:
          raise ValueError(
              'anneal_strategy must be one of "cos" or '
              f'"linear", instead got {anneal_strategy}'
          )
      elif anneal_strategy == "cos":
          self.anneal_func = annealing_cos
      elif anneal_strategy == "linear":
          self.anneal_func = annealing_linear
      self.div_factor = div_factor
      self.final_div_factor = final_div_factor
      self.three_phase = three_phase
      self.lr_phases = []  # init lr_phases
      super(OneCycleLrUpdaterHook, self).__init__(**kwargs)
  
imports: import numbers
  from math import cos, pi
  import annotator.uniformer.mmcv
  from .hook import HOOKS, Hook
label_desc: Use image node_id 1 to create a new OneCycleLrUpdaterHook object from inherited base classes: LrUpdaterHook with example: obj = OneCycleLrUpdaterHook(max_lr, total_steps, pct_start, anneal_strategy, div_factor, final_div_factor, three_phase)