class_docstr: BatchSampler - from a MNIST-like dataset, samples n_samples for each of the n_classes.
  Returns batches of size n_classes * (batch_size // n_classes)
  adapted from https://github.com/adambielski/siamese-triplet/blob/master/datasets.py
class_docstr_tok: ["BatchSampler","-","from","a","MNIST-like","dataset",",","samples","n_samples","for","each","of","the","n_classes",".","Returns","batches","of","size","n_classes","*","(","batch_size","\/\/","n_classes",")","adapted","from","https",":","\/\/github.com\/adambielski\/siamese-triplet\/blob\/master\/datasets.py"]
code: def __len__(self):
      return self._n_batches
  
imports: import logging
  import numpy
  import torch.utils.data
  import torchvision
  from torch.utils.data.sampler import BatchSampler, RandomSampler
label_desc: Use image node_id 3 for calling the BalancedBatchSampler obj's underlying member method code with example usage: obj.__len__() and returns: self