code: def _extract_image(doc):
      # type: (np.ndarray) -> 'PIL.Image.Image'
      """Convert ``doc`` tensor to image."""
      (im_arr,) = doc  # rank 4 batch -> rank 3 single image
      image = array_to_img(im_arr)
      return image
  
imports: from __future__ import absolute_import
  from typing import Union, Optional, Callable, Tuple, List, TYPE_CHECKING
  import numpy
  import keras
  import keras.backend
  from keras.models import Model
  from keras.layers import Layer
  from keras.layers import Conv2D, MaxPooling2D, AveragePooling2D, GlobalMaxPooling2D, GlobalAveragePooling2D
  from keras.preprocessing.image import array_to_img
  from eli5.base import Explanation, TargetExplanation
  from eli5.explain import explain_prediction
  from .gradcam import gradcam, gradcam_backend
label_desc: Use image node_id 8 for calling a global function with example usage: _extract_image(doc) and returns: image