class_docstr: DDP version of  VariableBatchSampler
  
  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: ["DDP","version","of","VariableBatchSampler","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]]:
      indices_rank_i = self.get_indices_rank_i()
      start_index = 0
      n_samples_rank_i = len(indices_rank_i)
      while start_index < n_samples_rank_i:
          crop_h, crop_w, batch_size = random.choice(
              self.img_batch_tuples
          )
  
          end_index = min(start_index + batch_size, n_samples_rank_i)
          batch_ids = indices_rank_i[start_index:end_index]
          n_batch_samples = len(batch_ids)
          if n_batch_samples != batch_size:
              batch_ids += indices_rank_i[
                  : (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 VariableBatchSamplerDDP obj's underlying member method code with example usage: obj.__iter__() without return types