class_docstr: A generic data loader where the samples are arranged in this way: ::
  
      root/domain_a/class_1/xxx.ext
      root/domain_a/class_1/xxy.ext
      root/domain_a/class_2/xxz.ext
  
      root/domain_b/class_1/efg.ext
      root/domain_b/class_2/pqr.ext
      root/domain_b/class_2/lmn.ext
  
      root/domain_k/class_2/123.ext
      root/domain_k/class_1/abc3.ext
      root/domain_k/class_1/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. Either extensions or is_valid_file should 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.
      sub_domain_set (list): A list of domain names, which should be a subset of domains (folders) under the root
          directory. If None, all available domains will be used. Defaults to None.
      sub_class_set (list): A list of class names, which should be a subset of classes (folders) under each
          domain's directory. If None, all available classes will be used. Defaults to None.
      is_valid_file (callable, optional): A function that takes path of a file and check if the file is a valid
          file (to check corrupt files). Either extensions or is_valid_file should 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
      domains (list): List of the domain names sorted alphabetically.
      domain_to_idx (dict): Dict with items (domain_name, domain_index).
      domain_labels (list): The domain_index value for each image in the dataset
class_docstr_tok: ["A","generic","data","loader","where","the","samples","are","arranged","in","this","way",":",":",":","root\/domain_a\/class_1\/xxx.ext","root\/domain_a\/class_1\/xxy.ext","root\/domain_a\/class_2\/xxz.ext","root\/domain_b\/class_1\/efg.ext","root\/domain_b\/class_2\/pqr.ext","root\/domain_b\/class_2\/lmn.ext","root\/domain_k\/class_2\/123.ext","root\/domain_k\/class_1\/abc3.ext","root\/domain_k\/class_1\/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",".","Either","extensions","or","is_valid_file","should","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",".","sub_domain_set","(","list",")",":","A","list","of","domain","names",",","which","should","be","a","subset","of","domains","(","folders",")","under","the","root","directory",".","If","None",",","all","available","domains","will","be","used",".","Defaults","to","None",".","sub_class_set","(","list",")",":","A","list","of","class","names",",","which","should","be","a","subset","of","classes","(","folders",")","under","each","domain","'s","directory",".","If","None",",","all","available","classes","will","be","used",".","Defaults","to","None",".","is_valid_file","(","callable",",","optional",")",":","A","function","that","takes","path","of","a","file","and","check","if","the","file","is","a","valid","file","(","to","check","corrupt","files",")",".","Either","extensions","or","is_valid_file","should","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","domains","(","list",")",":","List","of","the","domain","names","sorted","alphabetically",".","domain_to_idx","(","dict",")",":","Dict","with","items","(","domain_name",",","domain_index",")",".","domain_labels","(","list",")",":","The","domain_index","value","for","each","image","in","the","dataset"]
docstr: Args:
      index (int): Index
  Returns:
      tuple: (sample, target, domain) where target is class_index of the target class.
code: def __getitem__(self, index: int) -> Tuple:
      """
      Args:
          index (int): Index
      Returns:
          tuple: (sample, target, domain) where target is class_index of the target class.
      """
      path, target, domain = 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)
      if self.return_domain_label:
          return sample, target, domain
      else:
          return sample, target
  
imports: import logging
  import os
  from enum import Enum
  from typing import Any, Callable, cast, Dict, List, Optional, Tuple
  import numpy
  import torch.utils.data
  from sklearn.utils import check_random_state
  from torchvision.datasets import VisionDataset
  from torchvision.datasets.folder import default_loader, has_file_allowed_extension, IMG_EXTENSIONS
  from kale.loaddata.dataset_access import DatasetAccess, get_class_subset, split_by_ratios
  from kale.loaddata.sampler import FixedSeedSamplingConfig, get_labels, MultiDataLoader, SamplingConfig
label_desc: Use image node_id 3 for calling the MultiDomainImageFolder obj's underlying member method code with example usage: obj.__getitem__(index) and returns: sample,  target,  domain, sample,  target