code: def extract_images(filename):
      """Extract the images into a 4D uint8 numpy array [index, y, x, depth]."""
      with gzip.open(filename) as bytestream:
          magic = _read32(bytestream)
          if magic != 2051:
              raise ValueError(
                  "Invalid magic number %d in MNIST image file: %s"
                  % (magic, filename)
              )
          num_images = _read32(bytestream)
          rows = _read32(bytestream)
          cols = _read32(bytestream)
          buf = bytestream.read(rows * cols * num_images)
          data = numpy.frombuffer(buf, dtype=numpy.uint8)
          data = data.reshape(num_images, rows, cols, 1)
          data = data.astype("float32") / 255.0
          return data
  
file_path: tensorpack/tensorpack/dataflow/dataset/mnist.py
imports: import gzip
  import numpy
  import os
  from ...utils import logger
  from ...utils.fs import download, get_dataset_path
  from ..base import RNGDataFlow
label_desc: Use image node_id 3 for calling a global function with example usage: extract_images(filename) and returns: data