code: def saliency_map(output, input, name="saliency_map"):
      """
      Produce a saliency map as described in the paper:
      `Deep Inside Convolutional Networks: Visualising Image Classification Models and Saliency Maps
      <https://arxiv.org/abs/1312.6034>`_.
      The saliency map is the gradient of the max element in output w.r.t input.
  
      Returns:
          tf.Tensor: the saliency map. Has the same shape as input.
      """
      max_outp = tf.reduce_max(output, 1)
      saliency_op = tf.gradients(max_outp, input)[:][0]
      return tf.identity(saliency_op, name=name)
  
file_path: tensorpack/examples/Saliency/saliency-maps.py
imports: import numpy
  import sys
  from contextlib import contextmanager
  import cv2
  import tensorflow
  import tensorflow.contrib.slim
  from tensorflow.contrib.slim.nets import resnet_v1
  import tensorpack
  import tensorpack.utils.viz
  from tensorpack.tfutils import get_tf_version_tuple
label_desc: Use image node_id 2 for calling a global function with example usage: saliency_map(output, input, name) and returns: tf