class_docstr: To run: "python -m saliency.core.xrai_test" from the top-level directory.
class_docstr_tok: ["To","run",":","``","python","-m","saliency.core.xrai_test","''","from","the","top-level","directory","."]
code: def setUp(self):
      super(XraiTest, self).setUp()
  
      def call_model_function():
          return
  
      # Mock IntegratedGradients.
      self.patcher_ig = mock.patch(
          __name__ + ".xrai.IntegratedGradients"
      )
      self.mock_ig = self.patcher_ig.start()
      self.input_image = (
          np.random.rand(IMAGE_SIZE, IMAGE_SIZE, 3) * 0.3 + 0.5
      )
      self.ig_bl_1_attr = (
          np.random.rand(IMAGE_SIZE, IMAGE_SIZE, 3) - 0.4
      )
      self.ig_bl_2_attr = (
          np.random.rand(IMAGE_SIZE, IMAGE_SIZE, 3) - 0.4
      )
      self.mock_ig_instance = mock.Mock()
      self.mock_ig_instance.GetMask.side_effect = [
          self.ig_bl_1_attr,
          self.ig_bl_2_attr,
          self.ig_bl_1_attr,
          self.ig_bl_2_attr,
      ]
      self.mock_ig.return_value = self.mock_ig_instance
  
      # IG attribution that XRAI should calculate internally.
      self.ig_mask = np.asarray(
          [self.ig_bl_1_attr, self.ig_bl_2_attr]
      ).mean(axis=0)
      # A mocked XRAI object that uses neither the graph, session, x or y values.
      self.xrai = XRAI()
      self.call_model_function = call_model_function
  
imports: import unittest
  import unittest.mock
  import numpy
  import skimage.draw
  from .None import xrai
  from .xrai import XRAI
  from .xrai import XRAIParameters
label_desc: Use image node_id 1 for calling the XraiTest obj's underlying member method code with example usage: obj.setUp() without return types