class_docstr: MNIST data set from http://yann.lecun.com/exdb/mnist/
  
  Normalize defaults to true and scales the data 0 to 1.
  Size defaults to 28 for 28x28 pixels, specifying a smaller values allows
  cropping to a smaller size.
docstr: Fetch the MNIST dataset and load it into memory.
  
  Arguments:
      path (str, optional): Local directory in which to cache the raw
                            dataset.  Defaults to current directory.
      normalize (bool, optional): Whether to scale values between 0 and 1.
                                  Defaults to True.
  
  Returns:
      tuple: Both training and test sets are returned.
docstr_tok: ["Fetch","the","MNIST","dataset","and","load","it","into","memory",".","Arguments",":","path","(","str",",","optional",")",":","Local","directory","in","which","to","cache","the","raw","dataset",".","Defaults","to","current","directory",".","normalize","(","bool",",","optional",")",":","Whether","to","scale","values","between","0","and","1",".","Defaults","to","True",".","Returns",":","tuple",":","Both","training","and","test","sets","are","returned","."]
code: def load_data(self):
      """
      Fetch the MNIST dataset and load it into memory.
  
      Arguments:
          path (str, optional): Local directory in which to cache the raw
                                dataset.  Defaults to current directory.
          normalize (bool, optional): Whether to scale values between 0 and 1.
                                      Defaults to True.
  
      Returns:
          tuple: Both training and test sets are returned.
      """
      filepath = self._valid_path_append(self.path, self.filename)
      if not os.path.exists(filepath):
          self.fetch_dataset(
              self.url, self.filename, filepath, self.size
          )
  
      with gzip.open(filepath, "rb") as mnist:
          (X_train, y_train), (X_test, y_test) = pickle_load(mnist)
  
          if self.subset_pct < 100:
              X_train = X_train[
                  : int(X_train.shape[0] * self.subset_pct / 100.0)
              ]
              y_train = y_train[
                  : int(y_train.shape[0] * self.subset_pct / 100.0)
              ]
              X_test = X_test[
                  : int(X_test.shape[0] * self.subset_pct / 100.0)
              ]
              y_test = y_test[
                  : int(y_test.shape[0] * self.subset_pct / 100.0)
              ]
              logger.debug("subset %d%% of data", self.subset_pct * 100)
  
          if self.size > 28:
              n_train, n_test = X_train.shape[0], X_test.shape[0]
              X_train_ = np.zeros(shape=(n_train, self.size, self.size))
              X_test_ = np.zeros(shape=(n_test, self.size, self.size))
              X_train_[:, :28, :28] = X_train
              X_test_[:, :28, :28] = X_test
          else:
              X_train_ = X_train[:, : self.size, : self.size]
              X_test_ = X_test[:, : self.size, : self.size]
          X_train = X_train_.reshape(-1, self.size * self.size)
          X_test = X_test_.reshape(-1, self.size * self.size)
  
          if self.normalize:
              X_train = X_train / 255.0
              X_test = X_test / 255.0
              if self.sym_range:
                  X_train = X_train * 2.0 - 1.0
                  X_test = X_test * 2.0 - 1.0
  
          if self.shuffle:
              np.random.seed(0)
              np.random.shuffle(X_train)
  
      return (X_train, y_train), (X_test, y_test), 10
  
imports: from __future__ import division
  from future import standard_library
  from builtins import str
  import gzip
  import logging
  import numpy
  import os
  import tarfile
  from neon.util.compat import pickle
  from neon.util.compat import pickle_load
  from neon.data.datasets import Dataset
  from neon.data.dataiterator import ArrayIterator
label_desc: Use image node_id 2 for calling the MNIST obj's underlying member method code with example usage: obj.load_data() and returns: X_train,  y_train,  X_test,  y_test,  int