class_docstr: Standard Batch Sampler for data parallel. This sampler yields batches of fixed batch size
  and spatial resolutions.
  
  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
      batch_size = self.batch_size_gpu0
      n_samples = len(img_indices)
      while start_index < n_samples:
          end_index = min(start_index + batch_size, n_samples)
          batch_ids = img_indices[start_index:end_index]
          start_index += batch_size
  
          if len(batch_ids) > 0:
              batch = [
                  (self.crop_size_h, self.crop_size_w, b_id)
                  for b_id in batch_ids
              ]
              yield batch
  
file_path: ml-cvnets/data/sampler/batch_sampler.py
imports: import argparse
  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
label_desc: Use image node_id 2 for calling the BatchSampler obj's underlying member method code with example usage: obj.__iter__() without return types