code: def load_mnist(dataset, path):
      """
      wget -O - http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz | gunzip > train-images-idx3-ubyte
      wget -O - http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz | gunzip > train-labels-idx1-ubyte
      wget -O - http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz | gunzip > t10k-images-idx3-ubyte
      wget -O - http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz | gunzip > t10k-labels-idx1-ubyte
      """
      if dataset is "training":
          fname_img = os.path.join(path, "train-images-idx3-ubyte")
          fname_lbl = os.path.join(path, "train-labels-idx1-ubyte")
      elif dataset is "testing":
          fname_img = os.path.join(path, "t10k-images-idx3-ubyte")
          fname_lbl = os.path.join(path, "t10k-labels-idx1-ubyte")
      else:
          raise ValueError("dataset must be 'testing' or 'training'")
  
      # Load everything in numpy arrays
      with open(fname_lbl, "rb") as flbl:
          magic, num = struct.unpack(">II", flbl.read(8))
          labels = np.fromfile(flbl, dtype=np.int8)
  
      with open(fname_img, "rb") as fimg:
          magic, num, rows, cols = struct.unpack(">IIII", fimg.read(16))
          images = np.multiply(
              np.fromfile(fimg, dtype=np.uint8).reshape(
                  len(labels), rows * cols
              ),
              1.0 / 255.0,
          )
  
      get_instance = lambda idx: (
          labels[idx],
          images[idx].reshape(1, 28, 28),
      )
  
      # Create an iterator which returns each image in turn
      # for i in range(len(labels)):
      #     yield get_instance(i)
  
      size_reset = lambda x: x.reshape(1, 28, 28)
      return list(map(size_reset, images))
  
imports: import os, struct
  import numpy
  import math
label_desc: Use image node_id 1 for calling a global function with example usage: load_mnist(dataset, path) and returns: list