class_docstr: A sampler wrapper for grouping images with similar aspect ratio (< 1 or.
  
  >= 1) into a same batch for multi-source datasets.
  
  Args:
      sampler (Sampler): Base sampler.
      batch_size (Sequence(int)): Size of mini-batch for multi-source
      datasets.
      num_datasets(int): Number of multi-source datasets.
      drop_last (bool): If ``True``, the sampler will drop the last batch if
      its size would be less than ``batch_size``.
class_docstr_tok: ["A","sampler","wrapper","for","grouping","images","with","similar","aspect","ratio","(","<","1","or",".",">","=","1",")","into","a","same","batch","for","multi-source","datasets",".","Args",":","sampler","(","Sampler",")",":","Base","sampler",".","batch_size","(","Sequence","(","int",")",")",":","Size","of","mini-batch","for","multi-source","datasets",".","num_datasets","(","int",")",":","Number","of","multi-source","datasets",".","drop_last","(","bool",")",":","If","``","True","``",",","the","sampler","will","drop","the","last","batch","if","its","size","would","be","less","than","``","batch_size","``","."]
code: def __init__(
      self,
      sampler: Sampler,
      batch_size: Sequence[int],
      num_datasets: int,
      drop_last: bool = True,
  ) -> None:
      if not isinstance(sampler, Sampler):
          raise TypeError(
              "sampler should be an instance of ``Sampler``, "
              f"but got {sampler}"
          )
      self.sampler = sampler
      self.batch_size = batch_size
      self.num_datasets = num_datasets
      self.drop_last = drop_last
      # two groups for w < h and w >= h for each dataset --> 2 * num_datasets
      self._buckets = [[] for _ in range(2 * self.num_datasets)]
  
file_path: mmdetection/mmdet/datasets/samplers/batch_sampler.py
imports: from typing import Sequence
  from torch.utils.data import BatchSampler, Sampler
  from mmdet.datasets.samplers.track_img_sampler import TrackImgSampler
  from mmdet.registry import DATA_SAMPLERS
label_desc: Use image node_id 1 to create a new MultiDataAspectRatioBatchSampler object from inherited base classes: BatchSampler with example: obj = MultiDataAspectRatioBatchSampler(sampler, batch_size, num_datasets, drop_last)