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

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
extract the images into a numpy array .