class_docstr: A TF1Saliency class that computes saliency masks with GuidedBackProp.
  
  This implementation copies the TensorFlow graph to a new graph with the ReLU
  gradient overwritten as in the paper:
  https://arxiv.org/abs/1412.6806
  
  Thanks to Chris Olah for generously sharing his implementation of the ReLU
  backprop.
docstr: Constructs a GuidedBackprop method using TF1 Saliency.
docstr_tok: ["Constructs","a","GuidedBackprop","method","using","TF1","Saliency","."]
code: def __init__(
      self,
      graph,
      session,
      y,
      x,
      tmp_ckpt_path="/tmp/guided_backprop_ckpt",
  ):
      """Constructs a GuidedBackprop method using TF1 Saliency."""
      super(GuidedBackprop, self).__init__(graph, session, y, x)
      tensorflow = _import_tf()
      tf = tensorflow.compat.v1
  
      self.x = x
  
      if not GuidedBackprop.guided_relu_registered:
          #### Acknowledgement to Chris Olah ####
          @tf.RegisterGradient("GuidedRelu")
          def _GuidedReluGrad(op, grad):
              gate_g = tf.cast(grad > 0, "float32")
              gate_y = tf.cast(op.outputs[0] > 0, "float32")
              return gate_y * gate_g * grad
  
      GuidedBackprop.guided_relu_registered = True
  
      with graph.as_default():
          saver = tf.train.Saver()
          saver.save(session, tmp_ckpt_path)
  
      graph_def = graph.as_graph_def()
  
      self.guided_graph = tf.Graph()
      with self.guided_graph.as_default():
          self.guided_sess = tf.Session(graph=self.guided_graph)
          with self.guided_graph.gradient_override_map(
              {"Relu": "GuidedRelu"}
          ):
              # Import the graph def, and all the variables.
              tf.import_graph_def(graph_def, name="")
              saver.restore(self.guided_sess, tmp_ckpt_path)
  
              imported_y = self.guided_graph.get_tensor_by_name(y.name)
              imported_x = self.guided_graph.get_tensor_by_name(x.name)
  
              self.guided_grads_node = tf.gradients(
                  imported_y, imported_x
              )[0]
  
imports: from .base import TF1Saliency
  from .base import TF1Saliency
  from .utils import _import_tf
label_desc: Use image node_id 1 to create a new GuidedBackprop object from inherited base classes: TF1Saliency with example: obj = GuidedBackprop(graph, session, y, x, tmp_ckpt_path)