class_docstr: Wraps another sampler to yield a mini-batch of indices.
  
  Args:
      sampler (Sampler or Iterable): Base sampler. Can be any iterable object
      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``
  
  Example:
      >>> list(BatchSampler(SequentialSampler(range(10)), batch_size=3, drop_last=False))
      [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]]
      >>> list(BatchSampler(SequentialSampler(range(10)), batch_size=3, drop_last=True))
      [[0, 1, 2], [3, 4, 5], [6, 7, 8]]
class_docstr_tok: ["Wraps","another","sampler","to","yield","a","mini-batch","of","indices",".","Args",":","sampler","(","Sampler","or","Iterable",")",":","Base","sampler",".","Can","be","any","iterable","object","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","``","Example",":",">",">",">","list","(","BatchSampler","(","SequentialSampler","(","range","(","10",")",")",",","batch_size=3",",","drop_last=False",")",")","[","[","0",",","1",",","2","]",",","[","3",",","4",",","5","]",",","[","6",",","7",",","8","]",",","[","9","]","]",">",">",">","list","(","BatchSampler","(","SequentialSampler","(","range","(","10",")",")",",","batch_size=3",",","drop_last=True",")",")","[","[","0",",","1",",","2","]",",","[","3",",","4",",","5","]",",","[","6",",","7",",","8","]","]"]
code: def __len__(self) -> int:
      # Can only be called if self.sampler has __len__ implemented
      # We cannot enforce this condition, so we turn off typechecking for the
      # implementation below.
      # Somewhat related: see NOTE [ Lack of Default `__len__` in Python Abstract Base Classes ]
      if self.drop_last:
          return len(self.sampler) // self.batch_size  # type: ignore[arg-type]
      else:
          return (
              len(self.sampler) + self.batch_size - 1
          ) // self.batch_size
  
imports: import torch
  from torch import Tensor
  from typing import Iterator, Iterable, Optional, Sequence, List, TypeVar, Generic, Sized, Union
label_desc: Use image node_id 3 for calling the BatchSampler obj's underlying member method code with example usage: obj.__len__() and returns: unknown, unknown