code: def test_class_subsets(class_subset, valid_ratio, download_path):
      dataset_name = ALL[1]
      source, target, num_channels = DigitDataset.get_source_target(
          DigitDataset(dataset_name),
          DigitDataset(dataset_name),
          download_path,
      )
  
      dataset_subset = MultiDomainDatasets(
          source,
          target,
          config_weight_type=WEIGHT_TYPE[0],
          config_size_type=DATASIZE_TYPE[1],
          class_ids=class_subset,
      )
  
      train, valid = source.get_train_valid(valid_ratio)
      test = source.get_test()
      dataset_subset._source_by_split["train"] = get_class_subset(
          train, class_subset
      )
      dataset_subset._target_by_split[
          "train"
      ] = dataset_subset._source_by_split["train"]
      dataset_subset._source_by_split["valid"] = get_class_subset(
          valid, class_subset
      )
      dataset_subset._source_by_split["test"] = get_class_subset(
          test, class_subset
      )
  
      # Ground truth lengths
      train_dataset_subset_length = len(
          [1 for data in train if data[1] in class_subset]
      )
      valid_dataset_subset_length = len(
          [1 for data in valid if data[1] in class_subset]
      )
      test_dataset_subset_length = len(
          [1 for data in test if data[1] in class_subset]
      )
  
      assert (
          len(dataset_subset._source_by_split["train"])
          == train_dataset_subset_length
      )
      assert (
          len(dataset_subset._source_by_split["valid"])
          == valid_dataset_subset_length
      )
      assert (
          len(dataset_subset._source_by_split["test"])
          == test_dataset_subset_length
      )
      assert len(dataset_subset) == train_dataset_subset_length
  
file_path: pykale/tests/loaddata/test_image_access.py
imports: import pytest
  import torch
  from numpy import testing
  from yacs.config import CfgNode
  from kale.loaddata.dataset_access import get_class_subset
  from kale.loaddata.image_access import DigitDataset, DigitDatasetAccess, get_cifar, ImageAccess
  from kale.loaddata.multi_domain import DomainsDatasetBase, MultiDomainAdapDataset, MultiDomainDatasets
label_desc: Use image node_id 7 for calling a global function with example usage: test_class_subsets(class_subset, valid_ratio, download_path) without return types