code: def load_mnist_data(args):
      '''
      Load MNIST dataset
      '''
      (x_train, y_train), (x_test, y_test) = mnist.load_data()
  
      x_train = (np.expand_dims(x_train, -1).astype(np.float) / 255.)[:args.num_train]
      x_test = (np.expand_dims(x_test, -1).astype(np.float) / 255.)[:args.num_test]
      y_train = keras.utils.to_categorical(y_train, NUM_CLASSES)[:args.num_train]
      y_test = keras.utils.to_categorical(y_test, NUM_CLASSES)[:args.num_test]
  
      LOG.debug('x_train shape: %s', (x_train.shape,))
      LOG.debug('x_test shape: %s', (x_test.shape,))
  
      return x_train, y_train, x_test, y_tesf load_mnist_data(args):
      '''
      Load MNIST dataset
      '''
      (x_train, y_train), (x_test, y_test) = mnist.load_data()
  
      x_train = (np.expand_dims(x_train, -1).astype(np.float) / 255.)[:args.num_train]
      x_test = (np.expand_dims(x_test, -1).astype(np.float) / 255.)[:args.num_test]
      y_train = keras.utils.to_categorical(y_train, NUM_CLASSES)[:args.num_train]
      y_test = keras.utils.to_categorical(y_test, NUM_CLASSES)[:args.num_test]
  
      LOG.debug('x_train shape: %s', (x_train.shape,))
      LOG.debug('x_test shape: %s', (x_test.shape,))
  
      return x_train, y_train, x_test, y_test
docs: Load MNIST dataset