code: def read_data_sets(
      train_dir,
      fake_data=False,  # pylint:disable=unused-argument
      one_hot=False,
      dtype=np.float32,
      reshape=True,
      validation_size=5000,
      seed=None,
  ):
      """Read multiple datasets."""
      # pylint:disable=invalid-name
      TRAIN_IMAGES = "train-images-idx3-ubyte.gz"
      TRAIN_LABELS = "train-labels-idx1-ubyte.gz"
      TEST_IMAGES = "t10k-images-idx3-ubyte.gz"
      TEST_LABELS = "t10k-labels-idx1-ubyte.gz"
  
      local_file = os.path.join(train_dir, TRAIN_IMAGES)
      with gfile.Open(local_file, "rb") as f:
          train_images = extract_images(f)
  
      local_file = os.path.join(train_dir, TRAIN_LABELS)
      with gfile.Open(local_file, "rb") as f:
          train_labels = extract_labels(f, one_hot=one_hot)
  
      local_file = os.path.join(train_dir, TEST_IMAGES)
      with gfile.Open(local_file, "rb") as f:
          test_images = extract_images(f)
  
      local_file = os.path.join(train_dir, TEST_LABELS)
      with gfile.Open(local_file, "rb") as f:
          test_labels = extract_labels(f, one_hot=one_hot)
  
      if not 0 <= validation_size <= len(train_images):
          raise ValueError(
              "Validation size should be between 0 and {}. Received: {}.".format(
                  len(train_images), validation_size
              )
          )
  
      validation_images = train_images[:validation_size]
      validation_labels = train_labels[:validation_size]
      train_images = train_images[validation_size:]
      train_labels = train_labels[validation_size:]
  
      options = dict(dtype=dtype, reshape=reshape, seed=seed)
  
      train = DataSet(train_images, train_labels, **options)
      validation = DataSet(
          validation_images, validation_labels, **options
      )
      test = DataSet(test_images, test_labels, **options)
  
      return train, validation, test
  
file_path: magenta/magenta/models/latent_transfer/local_mnist.py
imports: import gzip
  import os
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 5 for calling a global function with example usage: read_data_sets(train_dir, fake_data, one_hot, dtype, reshape, validation_size, seed) and returns: train,  validation,  test