code: def load_mnist(images, labels, num):
      data = np.zeros(num * dim, dtype=np.uint8).reshape((num, dim))
      target = np.zeros(num, dtype=np.uint8).reshape((num,))
  
      with gzip.open(images, "rb") as f_images, gzip.open(
          labels, "rb"
      ) as f_labels:
          f_images.read(16)
          f_labels.read(8)
          for i in six.moves.range(num):
              target[i] = ord(f_labels.read(1))
              for j in six.moves.range(dim):
                  data[i, j] = ord(f_images.read(1))
  
      return data, target
  
file_path: tensorboardX/examples/chainer/plain_logger/data.py
imports: import gzip
  import os
  import numpy
  import six
  from six.moves.urllib import request
label_desc: Use image node_id 1 for calling a global function with example usage: load_mnist(images, labels, num) and returns: data,  target