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","."]
docstr: Tests arbitrary baseline values can be used for calculating attributions.
docstr_tok: ["Tests","arbitrary","baseline","values","can","be","used","for","calculating","attributions","."]
code: def testBaselines(self):
      """Tests arbitrary baseline values can be used for calculating attributions."""
      # Create baselines and pass them to XRAI.GetMask(...).
      baseline_1 = np.random.rand(IMAGE_SIZE, IMAGE_SIZE, 3)
      baseline_2 = np.random.rand(IMAGE_SIZE, IMAGE_SIZE, 3)
      self.xrai.GetMask(
          x_value=self.input_image,
          call_model_function=self.call_model_function,
          baselines=[baseline_1, baseline_2],
      )
  
      # Verify that the XRAI object called Integrated Gradients with the baselines
      # that were passed to xrai.GetMask(...).
      calls = self.mock_ig_instance.method_calls
      self.assertEqual(
          2,
          len(calls),
          "There should be only two calls to IG Getmask()",
      )
      self.assertTrue(
          np.array_equal(baseline_1, calls[0][2]["x_baseline"]),
          msg="IG was called with incorrect baseline.",
      )
      self.assertTrue(
          np.array_equal(baseline_2, calls[1][2]["x_baseline"]),
          msg="IG was called with incorrect baseline.",
      )
  
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 9 for calling the XraiTest obj's underlying member method code with example usage: obj.testBaselines() without return types