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 add_arguments(
      cls, parser: argparse.ArgumentParser
  ) -> argparse.ArgumentParser:
      if cls != MultiScaleSampler:
          # Don't re-register arguments in subclasses that don't override `add_arguments()`.
          return parser
  
      group = parser.add_argument_group(cls.__name__)
      group.add_argument(
          "--sampler.msc.crop-size-width",
          default=DEFAULT_IMAGE_WIDTH,
          type=int,
          help=f"Base crop size (along width) during training. Defaults to {DEFAULT_IMAGE_WIDTH}.",
      )
      group.add_argument(
          "--sampler.msc.crop-size-height",
          default=DEFAULT_IMAGE_HEIGHT,
          type=int,
          help=f"Base crop size (along height) during training. Defaults to {DEFAULT_IMAGE_HEIGHT}.",
      )
  
      group.add_argument(
          "--sampler.msc.min-crop-size-width",
          default=160,
          type=int,
          help="Min. crop size along width during training. Defaults to 160.",
      )
      group.add_argument(
          "--sampler.msc.max-crop-size-width",
          default=320,
          type=int,
          help="Max. crop size along width during training. Defaults to 320.",
      )
  
      group.add_argument(
          "--sampler.msc.min-crop-size-height",
          default=160,
          type=int,
          help="Min. crop size along height during training. Defaults to 160.",
      )
      group.add_argument(
          "--sampler.msc.max-crop-size-height",
          default=320,
          type=int,
          help="Max. crop size along height during training. Defaults to 320.",
      )
      group.add_argument(
          "--sampler.msc.max-n-scales",
          default=5,
          type=int,
          help="Max. scales in variable batch sampler. Defaults to 5.",
      )
      group.add_argument(
          "--sampler.msc.check-scale",
          default=32,
          type=int,
          help="Image scales should be divisible by this factor. Defaults to 32.",
      )
      group.add_argument(
          "--sampler.msc.scale-inc",
          action="store_true",
          default=False,
          help="Increase image scales during training. Defaults to False.",
      )
  
      return parser
  
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 2 for calling the MultiScaleSampler obj's underlying member method code with example usage: obj.add_arguments(cls, parser) and returns: parser, parser