class_docstr: Extend Sampler to support "short cycle" sampling.
  See paper "A Multigrid Method for Efficiently Training Video Models",
  Wu et al., 2019 (https://arxiv.org/abs/1912.00998) for details.
code: def __init__(self, sampler, batch_size, drop_last, cfg):
      if not isinstance(sampler, Sampler):
          raise ValueError(
              "sampler should be an instance of "
              "torch.utils.data.Sampler, but got sampler={}".format(
                  sampler
              )
          )
      if (
          not isinstance(batch_size, _int_classes)
          or isinstance(batch_size, bool)
          or batch_size <= 0
      ):
          raise ValueError(
              "batch_size should be a positive integer value, "
              "but got batch_size={}".format(batch_size)
          )
      if not isinstance(drop_last, bool):
          raise ValueError(
              "drop_last should be a boolean value, but got "
              "drop_last={}".format(drop_last)
          )
      self.sampler = sampler
      self.drop_last = drop_last
  
      bs_factor = [
          int(
              round(
                  (
                      float(cfg.DATA.TRAIN_CROP_SIZE)
                      / (s * cfg.MULTIGRID.DEFAULT_S)
                  )
                  ** 2
              )
          )
          for s in cfg.MULTIGRID.SHORT_CYCLE_FACTORS
      ]
  
      self.batch_sizes = [
          batch_size * bs_factor[0],
          batch_size * bs_factor[1],
          batch_size,
      ]
  
imports: import numpy
  import torch
  from torch.utils.data.sampler import Sampler
label_desc: Use image node_id 1 to create a new ShortCycleBatchSampler object from inherited base classes: Sampler with example: obj = ShortCycleBatchSampler(sampler, batch_size, drop_last, cfg)