class_docstr: This class defines multigrid training schedule and update cfg accordingly.
docstr: Update cfg based on multigrid settings.
  Args:
      cfg (configs): configs that contains training and multigrid specific
          hyperparameters. Details can be seen in
          slowfast/config/defaults.py.
  Returns:
      cfg (configs): the updated cfg.
docstr_tok: ["Update","cfg","based","on","multigrid","settings",".","Args",":","cfg","(","configs",")",":","configs","that","contains","training","and","multigrid","specific","hyperparameters",".","Details","can","be","seen","in","slowfast\/config\/defaults.py",".","Returns",":","cfg","(","configs",")",":","the","updated","cfg","."]
code: def init_multigrid(self, cfg):
      """
      Update cfg based on multigrid settings.
      Args:
          cfg (configs): configs that contains training and multigrid specific
              hyperparameters. Details can be seen in
              slowfast/config/defaults.py.
      Returns:
          cfg (configs): the updated cfg.
      """
      self.schedule = None
      # We may modify cfg.TRAIN.BATCH_SIZE, cfg.DATA.NUM_FRAMES, and
      # cfg.DATA.TRAIN_CROP_SIZE during training, so we store their original
      # value in cfg and use them as global variables.
      cfg.MULTIGRID.DEFAULT_B = cfg.TRAIN.BATCH_SIZE
      cfg.MULTIGRID.DEFAULT_T = cfg.DATA.NUM_FRAMES
      cfg.MULTIGRID.DEFAULT_S = cfg.DATA.TRAIN_CROP_SIZE
  
      if cfg.MULTIGRID.LONG_CYCLE:
          self.schedule = self.get_long_cycle_schedule(cfg)
          cfg.SOLVER.STEPS = [0] + [s[-1] for s in self.schedule]
          # Fine-tuning phase.
          cfg.SOLVER.STEPS[-1] = (
              cfg.SOLVER.STEPS[-2] + cfg.SOLVER.STEPS[-1]
          ) // 2
          cfg.SOLVER.LRS = [
              cfg.SOLVER.GAMMA ** s[0] * s[1][0] for s in self.schedule
          ]
          # Fine-tuning phase.
          cfg.SOLVER.LRS = cfg.SOLVER.LRS[:-1] + [
              cfg.SOLVER.LRS[-2],
              cfg.SOLVER.LRS[-1],
          ]
  
          cfg.SOLVER.MAX_EPOCH = self.schedule[-1][-1]
  
      elif cfg.MULTIGRID.SHORT_CYCLE:
          cfg.SOLVER.STEPS = [
              int(s * cfg.MULTIGRID.EPOCH_FACTOR)
              for s in cfg.SOLVER.STEPS
          ]
          cfg.SOLVER.MAX_EPOCH = int(
              cfg.SOLVER.MAX_EPOCH * cfg.MULTIGRID.EPOCH_FACTOR
          )
      return cfg
  
imports: import numpy
  import slowfast.utils.logging
label_desc: Use image node_id 1 for calling the MultigridSchedule obj's underlying member method code with example usage: obj.init_multigrid(cfg) and returns: cfg