code: def load_mnist_dataset(mode='supervised', one_hot=True):
      
      mnist = input_data.read_data_sets("MNIST_data/", one_hot=one_hot)
  
      # Training set
      trX = mnist.train.images
      trY = mnist.train.labels
  
      # Validation set
      vlX = mnist.validation.images
      vlY = mnist.validation.labels
  
      # Test set
      teX = mnist.test.images
      teY = mnist.test.labels
  
      if mode == 'supervised':
          return trX, trY, vlX, vlY, teX, teY
  
      elif mode == 'unsupervised':
          return trX, vlX, teX
docs: Load the MNIST handwritten digits dataset.
  
      :param mode: 'supervised' or 'unsupervised' mode
      :param one_hot: whether to get one hot encoded labels
      :return: train, validation, test data:
              for (X, y) if 'supervised',
              for (X) if 'unsupervised'