code: def split_dataset(
      dataset: Dataset,
      lengths: List[int],
      deterministic_partitions: bool = False,
  ) -> List[Dataset]:
      """
      Split a dataset either randomly or deterministically.
  
      Args:
          dataset: the dataset to split
          lengths: the lengths of each partition
          deterministic_partitions: deterministic_partitions: whether to partition
              data in a deterministic fashion
  
      Returns:
          List[Dataset]: split datasets
      """
      if deterministic_partitions:
          indices = list(range(sum(lengths)))
      else:
          indices = torch.randperm(sum(lengths)).tolist()
      return [
          Subset(dataset, indices[offset - length : offset])
          for offset, length in zip(accumulate(lengths), lengths)
      ]
  
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 3 for calling a global function with example usage: split_dataset(dataset, lengths, deterministic_partitions) and returns: unknown