class_docstr: To run: "python -m saliency.tf1.grad_cam_test" from top-level saliency directory.
code: def setUp(self):
      super().setUp()
      self.graph = tf.Graph()
      with self.graph.as_default():
          # Input placeholder
          self.images = tf.placeholder(
              tf.float32,
              shape=(1, INPUT_HEIGHT_WIDTH, INPUT_HEIGHT_WIDTH, 1),
          )
  
          # Horizontal line detector filter
          horiz_detector = np.array(
              [[-1, -1, -1], [2, 2, 2], [-1, -1, -1]]
          )
          conv1 = tf.keras.layers.Conv2D(
              filters=1,
              kernel_size=3,
              kernel_initializer=tf.constant_initializer(
                  horiz_detector
              ),
              padding="same",
              name="Conv",
              input_shape=self.images.shape,
          )(self.images)
  
          # Compute logits and do prediction with pre-defined weights
          flat = tf.reshape(
              conv1, [-1, INPUT_HEIGHT_WIDTH * INPUT_HEIGHT_WIDTH]
          )
          sum_weights = tf.constant_initializer(np.ones(flat.shape))
          logits = tf.keras.layers.Dense(
              units=2, kernel_initializer=sum_weights, name="Logits"
          )(flat)
          y = logits[0][0]
  
          self.sess = tf.Session()
          init = tf.global_variables_initializer()
          self.sess.run(init)
          self.sess_spy = mock.MagicMock(wraps=self.sess)
  
          # Set up GradCam object
          self.conv_layer = self.graph.get_tensor_by_name(
              "Conv/BiasAdd:0"
          )
          self.grad_cam_instance = grad_cam.GradCam(
              self.graph,
              self.sess_spy,
              y=y,
              x=self.images,
              conv_layer=self.conv_layer,
          )
  
file_path: saliency/saliency/tf1/grad_cam_test.py
imports: import unittest
  import unittest.mock
  from .None import grad_cam
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling the GradCamTest obj's underlying member method code with example usage: obj.setUp() without return types