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 testBaseAttribution(self):
      base_attribution = np.random.rand(IMAGE_SIZE, IMAGE_SIZE, 3)
  
      # Calculate XRAI attribution using GetMask(...) method.
      heatmap = self.xrai.GetMask(
          x_value=self.input_image,
          call_model_function=self.call_model_function,
          base_attribution=base_attribution,
      )
      # Make sure that the GetMask() method doesn't return the same attribution
      # that was passed to it.
      self.assertFalse(
          np.array_equal(base_attribution.max(axis=2), heatmap)
      )
      # The sum of XRAI attribution should be equal to the sum of the underlying
      # base attribution. Internally the attribution that is used by XRAI is
      # the max over color channels.
      self.assertAlmostEqual(
          base_attribution.max(axis=2).sum(), heatmap.sum()
      )
  
      # Verify that the XRAI object didn't called Integrated Gradients.
      calls = self.mock_ig_instance.method_calls
      self.assertEqual(
          0, len(calls), "XRAI should not call Integrated Gradients."
      )
  
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 10 for calling the XraiTest obj's underlying member method code with example usage: obj.testBaseAttribution() without return types