class_docstr: To run: "python -m saliency.core.occlusion_test" from top-level saliency directory.
class_docstr_tok: ["To","run",":","``","python","-m","saliency.core.occlusion_test","''","from","top-level","saliency","directory","."]
docstr: Tests the Occlusion method errors with incorrect model outputs.
docstr_tok: ["Tests","the","Occlusion","method","errors","with","incorrect","model","outputs","."]
code: def testOcclusionValuesMismatch(self):
      """Tests the Occlusion method errors with incorrect model outputs."""
  
      def create_call_model_function():
          # Bad call model function since the expected output is a single value
          def call_model(
              x_value_batch, call_model_args=None, expected_keys=None
          ):
              output = np.ones(INPUT_HEIGHT_WIDTH)
              return {occlusion.OUTPUT_LAYER_VALUES: output}
  
          return call_model
  
      call_model_function = create_call_model_function()
      img = np.zeros([INPUT_HEIGHT_WIDTH, INPUT_HEIGHT_WIDTH])
      expected_error = SHAPE_ERROR_MESSAGE[OUTPUT_LAYER_VALUES].format(
          "1", "5"
      )
  
      with self.assertRaisesRegex(ValueError, expected_error):
          self.occlusion_instance.GetMask(
              img,
              call_model_function=call_model_function,
              call_model_args=None,
              size=3,
              value=0,
          )
  
file_path: saliency/saliency/core/occlusion_test.py
imports: import unittest
  import unittest.mock
  from .base import OUTPUT_LAYER_VALUES
  from .base import SHAPE_ERROR_MESSAGE
  from .None import occlusion
  import numpy
label_desc: Use image node_id 4 for calling the OcclusionTest obj's underlying member method code with example usage: obj.testOcclusionValuesMismatch() and returns: call_model, dict