(filename, num_images)
return data
Extract the images 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].
Extract the images into a numpy array.
Extract the images into a numpy array .
def _extract_images(filename, num_images):
  """Extract the images 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].
  """
  print('Extracting images from: ', filename)
  with gzip.open(filename) as bytestream:
    bytestream.read(16)
    buf = bytestream.read(
        _IMAGE_SIZE * _IMAGE_SIZE * num_images * _NUM_CHANNELS)
    data = np.frombuffer(buf, dtype=np.uint8)
    data = data.reshape(num_images, _IMAGE_SIZE, _IMAGE_SIZE, _NUM_CHANNELS)
  return data
def _extract_images ( filename , num_images ) : print ( 'Extracting images from: ' , filename ) with gzip . open ( filename ) as bytestream : bytestream . read ( 16 ) buf = bytestream . read ( _IMAGE_SIZE * _IMAGE_SIZE * num_images * _NUM_CHANNELS ) data = np . frombuffer ( buf , dtype = np . uint8 ) data = data . reshape ( num_images , _IMAGE_SIZE , _IMAGE_SIZE , _NUM_CHANNELS ) return data