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 (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: Finds the class folders in a dataset.
  Args:
      dir (string): Root directory path.
  Returns:
      tuple: (classes, class_to_idx) where classes are relative to (dir), and class_to_idx is a dictionary.
  Ensures:
      No class is a subdirectory of another.
docstr_tok: ["Finds","the","class","folders","in","a","dataset",".","Args",":","dir","(","string",")",":","Root","directory","path",".","Returns",":","tuple",":","(","classes",",","class_to_idx",")","where","classes","are","relative","to","(","dir",")",",","and","class_to_idx","is","a","dictionary",".","Ensures",":","No","class","is","a","subdirectory","of","another","."]
code: def _find_classes(self, dir: str) -> Tuple[List[str], Dict[str, int]]:
      """
      Finds the class folders in a dataset.
      Args:
          dir (string): Root directory path.
      Returns:
          tuple: (classes, class_to_idx) where classes are relative to (dir), and class_to_idx is a dictionary.
      Ensures:
          No class is a subdirectory of another.
      """
      all_classes = [d.name for d in os.scandir(dir) if d.is_dir()]
      classes = all_classes[
          0 : int(len(all_classes) * self.classes_fraction)
      ]
      classes.sort()
      class_to_idx = {cls_name: i for i, cls_name in enumerate(classes)}
      return classes, class_to_idx
  
imports: from torchvision.datasets import VisionDataset
  from PIL import Image
  import os
  import os.path
  from typing import Any, Callable, cast, Dict, List, Optional, Tuple
  import numpy
label_desc: Use image node_id 3 for calling the DatasetFolder obj's underlying member method code with example usage: obj._find_classes(dir) and returns: classes,  class_to_idx