class_docstr: A sampler wrapper for grouping images with similar aspect ratio (< 1 or.
  
  >= 1) into a same batch.
  
  Args:
      sampler (Sampler): Base sampler.
      batch_size (int): Size of mini-batch.
      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",".","Args",":","sampler","(","Sampler",")",":","Base","sampler",".","batch_size","(","int",")",":","Size","of","mini-batch",".","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: int, drop_last: bool = False
  ) -> None:
      if not isinstance(sampler, Sampler):
          raise TypeError(
              "sampler should be an instance of ``Sampler``, "
              f"but got {sampler}"
          )
      if not isinstance(batch_size, int) or batch_size <= 0:
          raise ValueError(
              "batch_size should be a positive integer value, "
              f"but got batch_size={batch_size}"
          )
      self.sampler = sampler
      self.batch_size = batch_size
      self.drop_last = drop_last
      # two groups for w < h and w >= h
      self._aspect_ratio_buckets = [[] for _ in range(2)]
  
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 AspectRatioBatchSampler object from inherited base classes: BatchSampler with example: obj = AspectRatioBatchSampler(sampler, batch_size, drop_last)