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
code: def __init__(
      self,
      root: str,
      loader: Callable[[str], Any],
      extensions: Optional[Tuple[str, ...]] = None,
      transform: Optional[Callable] = None,
      target_transform: Optional[Callable] = None,
      is_valid_file: Optional[Callable[[str], bool]] = None,
  ) -> None:
      super().__init__(
          root, transform=transform, target_transform=target_transform
      )
      classes, class_to_idx = self.find_classes(self.root)
      samples = self.make_dataset(
          self.root, class_to_idx, extensions, is_valid_file
      )
  
      self.loader = loader
      self.extensions = extensions
  
      self.classes = classes
      self.class_to_idx = class_to_idx
      self.samples = samples
      self.targets = [s[1] for s in samples]
  
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 1 to create a new DatasetFolder object from inherited base classes: VisionDataset with example: obj = DatasetFolder(root, loader, extensions, transform, target_transform, is_valid_file)