class_docstr: Cyclic momentum Scheduler.
  
  Implement the cyclical momentum scheduler policy described in
  https://arxiv.org/pdf/1708.07120.pdf
  
  This momentum scheduler usually used together with the CyclicLRUpdater
  to improve the performance in the 3D detection area.
  
  Attributes:
      target_ratio (tuple[float]): Relative ratio of the lowest momentum and
          the highest momentum to the initial momentum.
      cyclic_times (int): Number of cycles during training
      step_ratio_up (float): The ratio of the increasing process of momentum
          in  the total cycle.
      by_epoch (bool): Whether to update momentum by epoch.
class_docstr_tok: ["Cyclic","momentum","Scheduler",".","Implement","the","cyclical","momentum","scheduler","policy","described","in","https",":","\/\/arxiv.org\/pdf\/1708.07120.pdf","This","momentum","scheduler","usually","used","together","with","the","CyclicLRUpdater","to","improve","the","performance","in","the","3D","detection","area",".","Attributes",":","target_ratio","(","tuple","[","float","]",")",":","Relative","ratio","of","the","lowest","momentum","and","the","highest","momentum","to","the","initial","momentum",".","cyclic_times","(","int",")",":","Number","of","cycles","during","training","step_ratio_up","(","float",")",":","The","ratio","of","the","increasing","process","of","momentum","in","the","total","cycle",".","by_epoch","(","bool",")",":","Whether","to","update","momentum","by","epoch","."]
code: def before_run(self, runner):
      super(CyclicMomentumUpdaterHook, self).before_run(runner)
      # initiate momentum_phases
      # total momentum_phases are separated as up and down
      max_iter_per_phase = runner.max_iters // self.cyclic_times
      iter_up_phase = int(self.step_ratio_up * max_iter_per_phase)
      self.momentum_phases.append(
          [
              0,
              iter_up_phase,
              max_iter_per_phase,
              1,
              self.target_ratio[0],
          ]
      )
      self.momentum_phases.append(
          [
              iter_up_phase,
              max_iter_per_phase,
              max_iter_per_phase,
              self.target_ratio[0],
              self.target_ratio[1],
          ]
      )
  
imports: import annotator.uniformer.mmcv
  from .hook import HOOKS, Hook
  from .lr_updater import annealing_cos, annealing_linear, format_param
label_desc: Use image node_id 2 for calling the CyclicMomentumUpdaterHook obj's underlying member method code with example usage: obj.before_run(runner) without return types