class_docstr: A generic data loader.
  
  This default directory structure can be customized by overriding the
  :meth:`find_classes` method.
  
  Args:
      root (string): Root directory path.
      loader (callable): A function to load a sample given its path.
      extensions (tuple[string]): A list of allowed extensions.
          both extensions and is_valid_file should not be passed.
      transform (callable, optional): A function/transform that takes in
          a sample and returns a transformed version.
          E.g, ``transforms.RandomCrop`` for images.
      target_transform (callable, optional): A function/transform that takes
          in the target and transforms it.
      is_valid_file (callable, optional): A function that takes path of a file
          and check if the file is a valid file (used to check of corrupt files)
          both extensions and is_valid_file should not be passed.
  
   Attributes:
      classes (list): List of the class names sorted alphabetically.
      class_to_idx (dict): Dict with items (class_name, class_index).
      samples (list): List of (sample path, class_index) tuples
      targets (list): The class_index value for each image in the dataset
docstr: Args:
      index (int): Index
  
  Returns:
      tuple: (sample, target) where target is class_index of the target class.
docstr_tok: ["Args",":","index","(","int",")",":","Index","Returns",":","tuple",":","(","sample",",","target",")","where","target","is","class_index","of","the","target","class","."]
code: def __getitem__(self, index: int) -> Tuple[Any, Any]:
      """
      Args:
          index (int): Index
  
      Returns:
          tuple: (sample, target) where target is class_index of the target class.
      """
      path, target = self.samples[index]
      sample = self.loader(path)
      if self.transform is not None:
          sample = self.transform(sample)
      if self.target_transform is not None:
          target = self.target_transform(target)
  
      return sample, target
  
imports: import os
  import os.path
  from typing import Any, Callable, cast, Dict, List, Optional, Tuple, Union
  from PIL import Image
  from .vision import VisionDataset
label_desc: Use image node_id 4 for calling the DatasetFolder obj's underlying member method code with example usage: obj.__getitem__(index) and returns: sample,  target