code: def get_partition_data_loaders(
      train_valid_set: Dataset,
      test_set: Dataset,
      downsample_pct: float = 0.5,
      train_pct: float = 0.8,
      batch_size: int = 128,
      num_workers: int = 0,
      deterministic_partitions: bool = False,
      downsample_pct_test: Optional[float] = None,
  ) -> Tuple[DataLoader, DataLoader, DataLoader]:
      """
      Helper function for partitioning training data into training and validation sets,
          downsampling data, and initializing DataLoaders for each partition.
  
      Args:
          train_valid_set: torch.dataset
          downsample_pct: the proportion of the dataset to use for training, and
              validation
          train_pct: the proportion of the downsampled data to use for training
          batch_size: how many samples per batch to load
          num_workers: number of workers (subprocesses) for loading data
          deterministic_partitions: whether to partition data in a deterministic
              fashion
          downsample_pct_test: the proportion of the dataset to use for test, default
              to be equal to downsample_pct
  
      Returns:
          DataLoader: training data
          DataLoader: validation data
          DataLoader: test data
      """
      # Partition into training/validation
      # pyre-ignore [6]
      downsampled_num_examples = int(
          downsample_pct * len(train_valid_set)
      )
      n_train_examples = int(train_pct * downsampled_num_examples)
      n_valid_examples = downsampled_num_examples - n_train_examples
      train_set, valid_set, _ = split_dataset(
          dataset=train_valid_set,
          lengths=[
              n_train_examples,
              n_valid_examples,
              len(train_valid_set)
              - downsampled_num_examples,  # pyre-ignore [6]
          ],
          deterministic_partitions=deterministic_partitions,
      )
      if downsample_pct_test is None:
          downsample_pct_test = downsample_pct
      # pyre-ignore [6]
      downsampled_num_test_examples = int(
          downsample_pct_test * len(test_set)
      )
      test_set, _ = split_dataset(
          test_set,
          lengths=[
              downsampled_num_test_examples,
              len(test_set)
              - downsampled_num_test_examples,  # pyre-ignore [6]
          ],
          deterministic_partitions=deterministic_partitions,
      )
      train_loader = DataLoader(
          train_set,
          batch_size=batch_size,
          shuffle=True,
          num_workers=num_workers,
      )
      valid_loader = DataLoader(
          valid_set,
          batch_size=batch_size,
          shuffle=False,
          num_workers=num_workers,
      )
      test_loader = DataLoader(
          test_set,
          batch_size=batch_size,
          shuffle=False,
          num_workers=num_workers,
      )
      return train_loader, valid_loader, test_loader
  
file_path: Ax/ax/utils/tutorials/cnn_utils.py
imports: from itertools import accumulate
  from typing import Dict, List, Optional, Tuple
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.optim
  import torchvision
  import torchvision.transforms
  from torch._tensor import Tensor
  from torch.utils.data import DataLoader, Dataset, Subset
label_desc: Use image node_id 2 for calling a global function with example usage: get_partition_data_loaders(train_valid_set, test_set, downsample_pct, train_pct, batch_size, num_workers, deterministic_partitions, downsample_pct_test) and returns: train_loader,  valid_loader,  test_loader