code: def _extract_mnist_images(filename, num_images):
      """Extract images from an MNIST file into a numpy array.
  
      Args:
        filename: The path to an MNIST images file.
        num_images: The number of images in the file.
  
      Returns:
        A numpy array of shape [number_of_images, height, width, channels].
      """
      with gzip.open(filename) as bytestream:
          bytestream.read(16)
          buf = bytestream.read(
              _MNIST_IMAGE_SIZE * _MNIST_IMAGE_SIZE * num_images
          )
          data = np.frombuffer(buf, dtype=np.uint8)
          data = data.reshape(
              num_images, _MNIST_IMAGE_SIZE, _MNIST_IMAGE_SIZE, 1
          )
      return data
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import gzip
  import os
  import random
  import numpy
  from tensor2tensor.data_generators import generator_utils
  from tensor2tensor.data_generators import image_utils
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
label_desc: Use image node_id 2 for calling a global function with example usage: _extract_mnist_images(filename, num_images) and returns: data