class_docstr: Multi-scale batch sampler for data parallel. This sampler yields batches of fixed batch size, but each batch
  has different spatial resolution.
  
  Args:
      opts: command line argument
      n_data_samples: Number of samples in the dataset
      is_training: Training or validation mode. Default: False
class_docstr_tok: ["Multi-scale","batch","sampler","for","data","parallel",".","This","sampler","yields","batches","of","fixed","batch","size",",","but","each","batch","has","different","spatial","resolution",".","Args",":","opts",":","command","line","argument","n_data_samples",":","Number","of","samples","in","the","dataset","is_training",":","Training","or","validation","mode",".","Default",":","False"]
code: def __init__(
      self,
      opts,
      n_data_samples: int,
      is_training: bool = False,
      *args,
      **kwargs,
  ) -> None:
      super().__init__(
          opts=opts,
          n_data_samples=n_data_samples,
          is_training=is_training,
      )
  
      crop_size_w = getattr(opts, "sampler.msc.crop_size_width")
      crop_size_h = getattr(opts, "sampler.msc.crop_size_height")
  
      min_crop_size_w = getattr(opts, "sampler.msc.min_crop_size_width")
      max_crop_size_w = getattr(opts, "sampler.msc.max_crop_size_width")
  
      min_crop_size_h = getattr(
          opts, "sampler.msc.min_crop_size_height"
      )
      max_crop_size_h = getattr(
          opts, "sampler.msc.max_crop_size_height"
      )
  
      check_scale_div_factor = getattr(opts, "sampler.msc.check_scale")
      max_img_scales = getattr(opts, "sampler.msc.max_n_scales")
  
      scale_inc = getattr(opts, "sampler.msc.scale_inc")
  
      self.min_crop_size_w = min_crop_size_w
      self.max_crop_size_w = max_crop_size_w
      self.min_crop_size_h = min_crop_size_h
      self.max_crop_size_h = max_crop_size_h
  
      self.crop_size_w = crop_size_w
      self.crop_size_h = crop_size_h
  
      self.max_img_scales = max_img_scales
      self.check_scale_div_factor = check_scale_div_factor
      self.scale_inc = scale_inc
  
      if is_training:
          self.img_batch_tuples = image_batch_pairs(
              crop_size_h=self.crop_size_h,
              crop_size_w=self.crop_size_w,
              batch_size_gpu0=self.batch_size_gpu0,
              n_gpus=self.n_gpus,
              max_scales=self.max_img_scales,
              check_scale_div_factor=self.check_scale_div_factor,
              min_crop_size_w=self.min_crop_size_w,
              max_crop_size_w=self.max_crop_size_w,
              min_crop_size_h=self.min_crop_size_h,
              max_crop_size_h=self.max_crop_size_h,
          )
          # over-ride the batch-size
          self.img_batch_tuples = [
              (h, w, self.batch_size_gpu0)
              for h, w, b in self.img_batch_tuples
          ]
      else:
          self.img_batch_tuples = [
              (crop_size_h, crop_size_w, self.batch_size_gpu0)
          ]
  
imports: import argparse
  import random
  from typing import Iterator, Tuple
  from common import DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH
  from data.sampler import SAMPLER_REGISTRY
  from data.sampler.base_sampler import BaseSampler, BaseSamplerDDP
  from data.sampler.utils import image_batch_pairs
  from utils import logger
label_desc: Use image node_id 1 to create a new MultiScaleSampler object from inherited base classes: BaseSampler with example: obj = MultiScaleSampler(opts, n_data_samples, is_training)