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 __len__(self) -> int:
      sizes = [0 for _ in range(self.num_datasets)]
      for idx in self.sampler:
          dataset_source_idx = self.sampler.dataset.get_dataset_source(
              idx
          )
          sizes[dataset_source_idx] += 1
  
      if self.drop_last:
          lens = 0
          for i in range(self.num_datasets):
              lens += sizes[i] // self.batch_size[i]
          return lens
      else:
          lens = 0
          for i in range(self.num_datasets):
              lens += (
                  sizes[i] + self.batch_size[i] - 1
              ) // self.batch_size[i]
          return lens
  
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 3 for calling the MultiDataAspectRatioBatchSampler obj's underlying member method code with example usage: obj.__len__() and returns: lens, lens