class_docstr: A generic data loader where the samples are arranged in this way: ::
  
      root/class_x/xxx.ext
      root/class_x/xxy.ext
      root/class_x/xxz.ext
  
      root/class_y/123.ext
      root/class_y/nsdf3.ext
      root/class_y/asd932_.ext
  
  Args:
      root (string): Root directory path.
      loader (callable): A function to load a sample given its path.
      extensions (list[string]): A list of allowed extensions.
      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.
  
   Attributes:
      classes (list): List of the class names.
      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
class_docstr_tok: ["A","generic","data","loader","where","the","samples","are","arranged","in","this","way",":",":",":","root\/class_x\/xxx.ext","root\/class_x\/xxy.ext","root\/class_x\/xxz.ext","root\/class_y\/123.ext","root\/class_y\/nsdf3.ext","root\/class_y\/asd932_.ext","Args",":","root","(","string",")",":","Root","directory","path",".","loader","(","callable",")",":","A","function","to","load","a","sample","given","its","path",".","extensions","(","list","[","string","]",")",":","A","list","of","allowed","extensions",".","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",".","Attributes",":","classes","(","list",")",":","List","of","the","class","names",".","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,
      loader,
      extensions,
      transform=None,
      target_transform=None,
      label_mapping=None,
  ):
      classes, class_to_idx = self._find_classes(root)
      if label_mapping is not None:
          classes, class_to_idx = label_mapping(classes, class_to_idx)
  
      samples = make_dataset(root, class_to_idx, extensions)
      if len(samples) == 0:
          raise (
              RuntimeError(
                  "Found 0 files in subfolders of: " + root + "\n"
                  "Supported extensions are: " + ",".join(extensions)
              )
          )
  
      self.root = root
      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]
  
      self.transform = transform
      self.target_transform = target_transform
  
imports: import torch.utils.data
  from torch.utils.data import Dataset
  from torchvision import transforms
  from PIL import Image
  import os
  import os.path
  import sys
label_desc: Use image node_id 1 to create a new DatasetFolder object from inherited base classes: data with example: obj = DatasetFolder(root, loader, extensions, transform, target_transform, label_mapping)