class_docstr: A Multigrid Method for Efficiently Training Video Models
  Chao-Yuan Wu, Ross Girshick, Kaiming He, Christoph Feichtenhofer, Philipp Krähenbühl
  CVPR 2020, https://arxiv.org/abs/1912.00998
class_docstr_tok: ["A","Multigrid","Method","for","Efficiently","Training","Video","Models","Chao-Yuan","Wu",",","Ross","Girshick",",","Kaiming","He",",","Christoph","Feichtenhofer",",","Philipp","Kr\u00e4henb\u00fchl","CVPR","2020",",","https",":","\/\/arxiv.org\/abs\/1912.00998"]
docstr: :param sampler: torch.utils.data.Sample
  :param batch_size: int
  :param drop_last: bool
  :param use_long: bool
  :param use_short: bool
  Apply batch collecting function based on multiGridHelper definition
docstr_tok: [":","param","sampler",":","torch.utils.data.Sample",":","param","batch_size",":","int",":","param","drop_last",":","bool",":","param","use_long",":","bool",":","param","use_short",":","bool","Apply","batch","collecting","function","based","on","multiGridHelper","definition"]
code: def __init__(
      self,
      sampler,
      batch_size,
      drop_last,
      use_long=False,
      use_short=False,
  ):
      """
      :param sampler: torch.utils.data.Sample
      :param batch_size: int
      :param drop_last: bool
      :param use_long: bool
      :param use_short: bool
      Apply batch collecting function based on multiGridHelper definition
      """
      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)
          )
      if not isinstance(use_long, bool):
          raise ValueError(
              "use_long should be a boolean value, but got "
              "use_long={}".format(use_long)
          )
      if not isinstance(use_short, bool):
          raise ValueError(
              "use_short should be a boolean value, but got "
              "use_short={}".format(use_short)
          )
      self.sampler = sampler
      self.batch_size = batch_size
      self.drop_last = drop_last
  
      self.mg_helper = multiGridHelper()
      # single grid setting
      self.alpha = self.mg_helper.mod_long - 1
      self.beta = self.mg_helper.mod_short - 1
      self.short_cycle_label = False
      if use_long:
          self.activate_long_cycle()
      if use_short:
          self.activate_short_cycle()
      self.batch_scale = self.mg_helper.get_scale(self.alpha, self.beta)
  
file_path: gluon-cv/gluoncv/torch/data/video_cls/multigrid_helper.py
imports: from functools import reduce
  import numpy
  from torch.utils.data import Sampler
label_desc: Use image node_id 1 to create a new MultiGridBatchSampler object from inherited base classes: Sampler with example: obj = MultiGridBatchSampler(sampler, batch_size, drop_last, use_long, use_short)