class_docstr: This class defines multigrid training schedule and update cfg accordingly.
docstr: Based on multigrid hyperparameters, define the schedule of a long cycle.
  Args:
      cfg (configs): configs that contains training and multigrid specific
          hyperparameters. Details can be seen in
          slowfast/config/defaults.py.
  Returns:
      schedule (list): Specifies a list long cycle base shapes and their
          corresponding training epochs.
docstr_tok: ["Based","on","multigrid","hyperparameters",",","define","the","schedule","of","a","long","cycle",".","Args",":","cfg","(","configs",")",":","configs","that","contains","training","and","multigrid","specific","hyperparameters",".","Details","can","be","seen","in","slowfast\/config\/defaults.py",".","Returns",":","schedule","(","list",")",":","Specifies","a","list","long","cycle","base","shapes","and","their","corresponding","training","epochs","."]
code: def get_long_cycle_schedule(self, cfg):
      """
      Based on multigrid hyperparameters, define the schedule of a long cycle.
      Args:
          cfg (configs): configs that contains training and multigrid specific
              hyperparameters. Details can be seen in
              slowfast/config/defaults.py.
      Returns:
          schedule (list): Specifies a list long cycle base shapes and their
              corresponding training epochs.
      """
  
      steps = cfg.SOLVER.STEPS
  
      default_size = float(
          cfg.DATA.NUM_FRAMES * cfg.DATA.TRAIN_CROP_SIZE**2
      )
      default_iters = steps[-1]
  
      # Get shapes and average batch size for each long cycle shape.
      avg_bs = []
      all_shapes = []
      for t_factor, s_factor in cfg.MULTIGRID.LONG_CYCLE_FACTORS:
          base_t = int(round(cfg.DATA.NUM_FRAMES * t_factor))
          base_s = int(round(cfg.DATA.TRAIN_CROP_SIZE * s_factor))
          if cfg.MULTIGRID.SHORT_CYCLE:
              shapes = [
                  [
                      base_t,
                      cfg.MULTIGRID.DEFAULT_S
                      * cfg.MULTIGRID.SHORT_CYCLE_FACTORS[0],
                  ],
                  [
                      base_t,
                      cfg.MULTIGRID.DEFAULT_S
                      * cfg.MULTIGRID.SHORT_CYCLE_FACTORS[1],
                  ],
                  [base_t, base_s],
              ]
          else:
              shapes = [[base_t, base_s]]
  
          # (T, S) -> (B, T, S)
          shapes = [
              [
                  int(round(default_size / (s[0] * s[1] * s[1]))),
                  s[0],
                  s[1],
              ]
              for s in shapes
          ]
          avg_bs.append(np.mean([s[0] for s in shapes]))
          all_shapes.append(shapes)
  
      # Get schedule regardless of cfg.MULTIGRID.EPOCH_FACTOR.
      total_iters = 0
      schedule = []
      for step_index in range(len(steps) - 1):
          step_epochs = steps[step_index + 1] - steps[step_index]
  
          for long_cycle_index, shapes in enumerate(all_shapes):
              cur_epochs = (
                  step_epochs * avg_bs[long_cycle_index] / sum(avg_bs)
              )
  
              cur_iters = cur_epochs / avg_bs[long_cycle_index]
              total_iters += cur_iters
              schedule.append((step_index, shapes[-1], cur_epochs))
  
      iter_saving = default_iters / total_iters
  
      final_step_epochs = cfg.SOLVER.MAX_EPOCH - steps[-1]
  
      # We define the fine-tuning phase to have the same amount of iteration
      # saving as the rest of the training.
      ft_epochs = final_step_epochs / iter_saving * avg_bs[-1]
  
      schedule.append((step_index + 1, all_shapes[-1][2], ft_epochs))
  
      # Obtrain final schedule given desired cfg.MULTIGRID.EPOCH_FACTOR.
      x = (
          cfg.SOLVER.MAX_EPOCH
          * cfg.MULTIGRID.EPOCH_FACTOR
          / sum(s[-1] for s in schedule)
      )
  
      final_schedule = []
      total_epochs = 0
      for s in schedule:
          epochs = s[2] * x
          total_epochs += epochs
          final_schedule.append((s[0], s[1], int(round(total_epochs))))
      print_schedule(final_schedule)
      return final_schedule
  
imports: import numpy
  import slowfast.utils.logging
label_desc: Use image node_id 3 for calling the MultigridSchedule obj's underlying member method code with example usage: obj.get_long_cycle_schedule(cfg) and returns: final_schedule