docstr: Iterate the indices.
docstr_tok: ["Iterate","the","indices","."]
code: def __iter__(self) -> Iterator[int]:
      """Iterate the indices."""
      # deterministically shuffle based on epoch and seed
      g = torch.Generator()
      g.manual_seed(self.seed + self.epoch)
  
      out_index = []
      for data_size, data_index, cycle_iter in zip(
          self.dataset_size, self.dataset_index, self.dataset_cycle_iter
      ):
          if data_size == -1:
              out_index += data_index
          else:
              index = [next(cycle_iter) for _ in range(data_size)]
              out_index += index
  
      index = (
          torch.randperm(len(out_index), generator=g).numpy().tolist()
      )
      indices = [out_index[i] for i in index]
  
      if self.round_up:
          indices = (indices * int(self.total_size / len(indices) + 1))[
              : self.total_size
          ]
      indices = indices[self.rank : self.total_size : self.world_size]
      return iter(indices)
  
file_path: mmdetection/mmdet/datasets/samplers/custom_sample_size_sampler.py
imports: import math
  from typing import Iterator, Optional, Sequence, Sized
  import torch
  from mmengine.dist import get_dist_info, sync_random_seed
  from torch.utils.data import Sampler
  from mmdet.registry import DATA_SAMPLERS
  from .class_aware_sampler import RandomCycleIter
label_desc: Use image node_id 2 for calling the CustomSampleSizeSampler obj's underlying member method code with example usage: obj.__iter__() and returns: iter