class_docstr: Samples elements randomly from a given list of indices for imbalanced dataset
  
  :param indices: (list, optional): a list of indices
  :param num_samples: (int, optional): number of samples to draw
class_docstr_tok: ["Samples","elements","randomly","from","a","given","list","of","indices","for","imbalanced","dataset",":","param","indices",":","(","list",",","optional",")",":","a","list","of","indices",":","param","num_samples",":","(","int",",","optional",")",":","number","of","samples","to","draw"]
code: def _get_label(dataset, idx):
      dataset_type = type(dataset)
      if dataset_type is torchvision.datasets.MNIST:
          return dataset.train_labels[idx].item()
      elif dataset_type is torchvision.datasets.ImageFolder:
          return dataset.imgs[idx][1]
      elif (
          dataset_type is FolderDataset
          or dataset_type is MultiFolderDataset
          or dataset_type is PredictFolderDataset
          or dataset_type is ClonedFolderDataset
      ):
          return dataset.getdata()[idx][1]
      else:
          raise NotImplementedError
  
imports: import math
  from .utils import th_random_choice
  import torch.utils.data
  import torchvision
  from .datasets import FolderDataset, MultiFolderDataset, PredictFolderDataset, ClonedFolderDataset
  from torch.utils.data.sampler import Sampler
label_desc: Use image node_id 2 for calling the ImbalancedDatasetSampler obj's underlying member method code with example usage: obj._get_label(dataset, idx) and returns: dataset, dataset, dataset