class_docstr: Group Multi-Source Infinite Sampler.
  
  According to the sampling ratio, sample data from different
  datasets but the same group to form batches.
  
  Args:
      dataset (Sized): The dataset.
      batch_size (int): Size of mini-batch.
      source_ratio (list[int | float]): The sampling ratio of different
          source datasets in a mini-batch.
      shuffle (bool): Whether shuffle the dataset or not. Defaults to True.
      seed (int, optional): Random seed. If None, set a random seed.
          Defaults to None.
class_docstr_tok: ["Group","Multi-Source","Infinite","Sampler",".","According","to","the","sampling","ratio",",","sample","data","from","different","datasets","but","the","same","group","to","form","batches",".","Args",":","dataset","(","Sized",")",":","The","dataset",".","batch_size","(","int",")",":","Size","of","mini-batch",".","source_ratio","(","list","[","int","|","float","]",")",":","The","sampling","ratio","of","different","source","datasets","in","a","mini-batch",".","shuffle","(","bool",")",":","Whether","shuffle","the","dataset","or","not",".","Defaults","to","True",".","seed","(","int",",","optional",")",":","Random","seed",".","If","None",",","set","a","random","seed",".","Defaults","to","None","."]
code: def _get_source_group_info(self) -> None:
      self.group2size_per_source = [{0: 0, 1: 0}, {0: 0, 1: 0}]
      self.group2inds_per_source = [{0: [], 1: []}, {0: [], 1: []}]
      for source, dataset in enumerate(self.dataset.datasets):
          for idx in range(len(dataset)):
              data_info = dataset.get_data_info(idx)
              width, height = data_info["width"], data_info["height"]
              group = 0 if width < height else 1
              self.group2size_per_source[source][group] += 1
              self.group2inds_per_source[source][group].append(idx)
  
      self.group_sizes = np.zeros(2, dtype=np.int64)
      for group2size in self.group2size_per_source:
          for group, size in group2size.items():
              self.group_sizes[group] += size
      self.group_ratio = self.group_sizes / sum(self.group_sizes)
  
imports: import itertools
  from typing import Iterator, List, Optional, Sized, Union
  import numpy
  import torch
  from mmengine.dataset import BaseDataset
  from mmengine.dist import get_dist_info, sync_random_seed
  from torch.utils.data import Sampler
  from mmdet.registry import DATA_SAMPLERS
label_desc: Use image node_id 2 for calling the GroupMultiSourceSampler obj's underlying member method code with example usage: obj._get_source_group_info() without return types