parameters: (self, dir)
return_statement: return classes, class_to_idx
docstring: 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.
docstring_summary: Finds the class folders in a dataset.
docstring_tokens: Finds the class folders in a dataset .
function: def _find_classes(self, dir):
          """
          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.
  
          """
          if sys.version_info >= (3, 5):
              # Faster and available in Python 3.5 and above
              classes = [d.name for d in os.scandir(dir) if d.is_dir()]
          else:
              classes = [
                  d for d in os.listdir(dir)
                  if os.path.isdir(os.path.join(dir, d))
              ]
          classes.sort()
          class_to_idx = {classes[i]: i for i in range(len(classes))}
          return classes, class_to_idx
function_tokens: def _find_classes ( self , dir ) : if sys . version_info >= ( 3 , 5 ) : # Faster and available in Python 3.5 and above classes = [ d . name for d in os . scandir ( dir ) if d . is_dir ( ) ] else : classes = [ d for d in os . listdir ( dir ) if os . path . isdir ( os . path . join ( dir , d ) ) ] classes . sort ( ) class_to_idx = { classes [ i ] : i for i in range ( len ( classes ) ) } return classes , class_to_idx