class_docstr: Variably-size multi-scale batch sampler <https://arxiv.org/abs/2110.02178?context=cs.LG>` for data parallel.
  This sampler yields batches with variable spatial resolution and batch size.
  
  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: ["Variably-size","multi-scale","batch","sampler","<","https",":","\/\/arxiv.org\/abs\/2110.02178","?","context=cs.LG",">","`","for","data","parallel",".","This","sampler","yields","batches","with","variable","spatial","resolution","and","batch","size",".","Args",":","opts",":","command","line","argument","n_data_samples",":","Number","of","samples","in","the","dataset","is_training",":","Training","or","validation","mode",".","Default",":","False"]
code: def __iter__(self) -> Iterator[Tuple[int, int, int]]:
      img_indices = self.get_indices()
      start_index = 0
      n_samples = len(img_indices)
      while start_index < n_samples:
          crop_h, crop_w, batch_size = random.choice(
              self.img_batch_tuples
          )
  
          end_index = min(start_index + batch_size, n_samples)
          batch_ids = img_indices[start_index:end_index]
          n_batch_samples = len(batch_ids)
          if len(batch_ids) != batch_size:
              batch_ids += img_indices[: (batch_size - n_batch_samples)]
          start_index += batch_size
  
          if len(batch_ids) > 0:
              batch = [(crop_h, crop_w, b_id) for b_id in batch_ids]
              yield batch
  
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 VariableBatchSampler obj's underlying member method code with example usage: obj.__iter__() without return types