class_docstr: Concatenate multiple datasets as a single dataset with domain labels
  
  Args:
      data_access (dict): Dictionary of domain datasets, e.g. {"Domain1_name": domain1_set,
          "Domain2_name": domain2_set}
      domain_to_idx (dict): Dictionary of domain name to domain labels, e.g. {"Domain1_name": 0, "Domain2_name": 1}
      return_domain_label (Optional[bool], optional): Whether return domain labels in each batch. Defaults to False.
class_docstr_tok: ["Concatenate","multiple","datasets","as","a","single","dataset","with","domain","labels","Args",":","data_access","(","dict",")",":","Dictionary","of","domain","datasets",",","e.g",".","{","``","Domain1_name","''",":","domain1_set",",","``","Domain2_name","''",":","domain2_set","}","domain_to_idx","(","dict",")",":","Dictionary","of","domain","name","to","domain","labels",",","e.g",".","{","``","Domain1_name","''",":","0",",","``","Domain2_name","''",":","1","}","return_domain_label","(","Optional","[","bool","]",",","optional",")",":","Whether","return","domain","labels","in","each","batch",".","Defaults","to","False","."]
code: def __init__(
      self,
      data_access: dict,
      domain_to_idx: dict,
      return_domain_label: Optional[bool] = False,
  ):
      self.domain_to_idx = domain_to_idx
      self.data = []
      self.labels = []
      self.domain_labels = []
      for domain_ in domain_to_idx:
          n_samples = data_access[domain_].data.shape[0]
          for idx in range(n_samples):
              x, y = data_access[domain_][idx]
              self.data.append(x)
              self.labels.append(y)
              self.domain_labels.append(domain_to_idx[domain_])
  
      self.data = torch.stack(self.data)
      self.labels = torch.tensor(self.labels)
      self.domain_labels = torch.tensor(self.domain_labels)
      self.return_domain_label = return_domain_label
  
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 1 to create a new ConcatMultiDomainAccess object from inherited base classes: torch.utils.data with example: obj = ConcatMultiDomainAccess(data_access, domain_to_idx, return_domain_label)