class_docstr: This class defines multigrid training schedule and update cfg accordingly.
docstr: Before every epoch, check if long cycle shape should change. If it
      should, update cfg accordingly.
  Args:
      cfg (configs): configs that contains training and multigrid specific
          hyperparameters. Details can be seen in
          slowfast/config/defaults.py.
      cur_epoch (int): current epoch index.
  Returns:
      cfg (configs): the updated cfg.
      changed (bool): do we change long cycle shape at this epoch?
docstr_tok: ["Before","every","epoch",",","check","if","long","cycle","shape","should","change",".","If","it","should",",","update","cfg","accordingly",".","Args",":","cfg","(","configs",")",":","configs","that","contains","training","and","multigrid","specific","hyperparameters",".","Details","can","be","seen","in","slowfast\/config\/defaults.py",".","cur_epoch","(","int",")",":","current","epoch","index",".","Returns",":","cfg","(","configs",")",":","the","updated","cfg",".","changed","(","bool",")",":","do","we","change","long","cycle","shape","at","this","epoch","?"]
code: def update_long_cycle(self, cfg, cur_epoch):
      """
      Before every epoch, check if long cycle shape should change. If it
          should, update cfg accordingly.
      Args:
          cfg (configs): configs that contains training and multigrid specific
              hyperparameters. Details can be seen in
              slowfast/config/defaults.py.
          cur_epoch (int): current epoch index.
      Returns:
          cfg (configs): the updated cfg.
          changed (bool): do we change long cycle shape at this epoch?
      """
      base_b, base_t, base_s = get_current_long_cycle_shape(
          self.schedule, cur_epoch
      )
      if (
          base_s != cfg.DATA.TRAIN_CROP_SIZE
          or base_t != cfg.DATA.NUM_FRAMES
      ):
          cfg.DATA.NUM_FRAMES = base_t
          cfg.DATA.TRAIN_CROP_SIZE = base_s
          cfg.TRAIN.BATCH_SIZE = base_b * cfg.MULTIGRID.DEFAULT_B
  
          bs_factor = (
              float(cfg.TRAIN.BATCH_SIZE / cfg.NUM_GPUS)
              / cfg.MULTIGRID.BN_BASE_SIZE
          )
  
          if bs_factor < 1:
              cfg.BN.NORM_TYPE = "sync_batchnorm"
              cfg.BN.NUM_SYNC_DEVICES = int(1.0 / bs_factor)
          elif bs_factor > 1:
              cfg.BN.NORM_TYPE = "sub_batchnorm"
              cfg.BN.NUM_SPLITS = int(bs_factor)
          else:
              cfg.BN.NORM_TYPE = "batchnorm"
  
          cfg.MULTIGRID.LONG_CYCLE_SAMPLING_RATE = (
              cfg.DATA.SAMPLING_RATE
              * (cfg.MULTIGRID.DEFAULT_T // cfg.DATA.NUM_FRAMES)
          )
          logger.info("Long cycle updates:")
          logger.info("\tBN.NORM_TYPE: {}".format(cfg.BN.NORM_TYPE))
          if cfg.BN.NORM_TYPE == "sync_batchnorm":
              logger.info(
                  "\tBN.NUM_SYNC_DEVICES: {}".format(
                      cfg.BN.NUM_SYNC_DEVICES
                  )
              )
          elif cfg.BN.NORM_TYPE == "sub_batchnorm":
              logger.info(
                  "\tBN.NUM_SPLITS: {}".format(cfg.BN.NUM_SPLITS)
              )
          logger.info(
              "\tTRAIN.BATCH_SIZE: {}".format(cfg.TRAIN.BATCH_SIZE)
          )
          logger.info(
              "\tDATA.NUM_FRAMES x LONG_CYCLE_SAMPLING_RATE: {}x{}".format(
                  cfg.DATA.NUM_FRAMES,
                  cfg.MULTIGRID.LONG_CYCLE_SAMPLING_RATE,
              )
          )
          logger.info(
              "\tDATA.TRAIN_CROP_SIZE: {}".format(
                  cfg.DATA.TRAIN_CROP_SIZE
              )
          )
          return cfg, True
      else:
          return cfg, False
  
imports: import numpy
  import slowfast.utils.logging
label_desc: Use image node_id 2 for calling the MultigridSchedule obj's underlying member method code with example usage: obj.update_long_cycle(cfg, cur_epoch) and returns: cfg,  True, cfg,  False