code: def get_num_data_samples_as_int_or_mapping(
      dataset: BaseDataset,
  ) -> Union[int, Mapping[str, int]]:
      """Return the number of samples in the dataset.
  
      The dataset can be a single or composition of multiple datasets (as in multi-task learning). For a single
      dataset, the number of samples is integer while for multiple datasets, a dictionary is returned with task name and
      number of samples per task.
  
      Args:
          dataset: An instance of `data.datasets.BaseDataset` class
  
      Returns:
          An integer for single dataset and mapping for composite datasets.
  
      """
      if hasattr(dataset, "get_dataset_length_as_mapping"):
          return dataset.get_dataset_length_as_mapping()
      else:
          return len(dataset)
  
file_path: ml-cvnets/data/data_loaders.py
imports: import argparse
  from functools import partial
  from typing import Mapping, Optional, Tuple, Union
  from torch.utils.data.sampler import Sampler
  from data.collate_fns import build_collate_fn, build_test_collate_fn
  from data.datasets import BaseDataset, get_test_dataset, get_train_val_datasets
  from data.loader.dataloader import CVNetsDataLoader
  from data.sampler import build_sampler
  from utils import logger
  from utils.ddp_utils import is_master
  from utils.tensor_utils import image_size_from_opts
label_desc: Use image node_id 3 for calling a global function with example usage: get_num_data_samples_as_int_or_mapping(dataset) and returns: dataset, len