code: def guided_relu():
      """
      Returns:
          A context where the gradient of :meth:`tf.nn.relu` is replaced by
          guided back-propagation, as described in the paper:
          `Striving for Simplicity: The All Convolutional Net
          <https://arxiv.org/abs/1412.6806>`_
      """
      from tensorflow.python.ops import gen_nn_ops  # noqa
  
      @tf.RegisterGradient("GuidedReLU")
      def GuidedReluGrad(op, grad):
          return tf.where(
              0.0 < grad,
              gen_nn_ops.relu_grad(grad, op.outputs[0]),
              tf.zeros(grad.get_shape()),
          )
  
      g = tf.get_default_graph()
      with g.gradient_override_map({"Relu": "GuidedReLU"}):
          yield
  
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 1 for calling a global function with example usage: guided_relu() and returns: tf