class_docstr: A CoreSaliency class that computes saliency masks by occluding the image.
  
  This method slides a window over the image and computes how that occlusion
  affects the class score. When the class score decreases, this is positive
  evidence for the class, otherwise it is negative evidence.
docstr: Returns an occlusion mask.
  
  Args:
    x_value: Input ndarray.
    call_model_function: A function that interfaces with a model to return
      specific data in a dictionary when given an input and other arguments.
      Expected function signature:
      - call_model_function(x_value_batch,
                            call_model_args=None,
                            expected_keys=None):
        x_value_batch - Input for the model, given as a batch (i.e. dimension
          0 is the batch dimension, dimensions 1 through n represent a single
          input).
        call_model_args - Other arguments used to call and run the model.
        expected_keys - List of keys that are expected in the output. For this
          method (Occlusion), the expected keys are
          OUTPUT_LAYER_VALUES - Values of the output being
            explained (the logit/softmax value) with respect to the input.
            Outermost dimension should be the same size as x_value_batch.
    call_model_args: The arguments that will be passed to the call model
      function, for every call of the model.
    size: Height and width of the occlusion window. Default is 15.
    value: Value to repalce values inside the occlusion window with. Default
      is 0.
docstr_tok: ["Returns","an","occlusion","mask",".","Args",":","x_value",":","Input","ndarray",".","call_model_function",":","A","function","that","interfaces","with","a","model","to","return","specific","data","in","a","dictionary","when","given","an","input","and","other","arguments",".","Expected","function","signature",":","-","call_model_function","(","x_value_batch",",","call_model_args=None",",","expected_keys=None",")",":","x_value_batch","-","Input","for","the","model",",","given","as","a","batch","(","i.e",".","dimension","0","is","the","batch","dimension",",","dimensions","1","through","n","represent","a","single","input",")",".","call_model_args","-","Other","arguments","used","to","call","and","run","the","model",".","expected_keys","-","List","of","keys","that","are","expected","in","the","output",".","For","this","method","(","Occlusion",")",",","the","expected","keys","are","OUTPUT_LAYER_VALUES","-","Values","of","the","output","being","explained","(","the","logit\/softmax","value",")","with","respect","to","the","input",".","Outermost","dimension","should","be","the","same","size","as","x_value_batch",".","call_model_args",":","The","arguments","that","will","be","passed","to","the","call","model","function",",","for","every","call","of","the","model",".","size",":","Height","and","width","of","the","occlusion","window",".","Default","is","15.","value",":","Value","to","repalce","values","inside","the","occlusion","window","with",".","Default","is","0","."]
code: def GetMask(
      self,
      x_value,
      call_model_function,
      call_model_args=None,
      size=15,
      value=0,
  ):
      """Returns an occlusion mask.
  
      Args:
        x_value: Input ndarray.
        call_model_function: A function that interfaces with a model to return
          specific data in a dictionary when given an input and other arguments.
          Expected function signature:
          - call_model_function(x_value_batch,
                                call_model_args=None,
                                expected_keys=None):
            x_value_batch - Input for the model, given as a batch (i.e. dimension
              0 is the batch dimension, dimensions 1 through n represent a single
              input).
            call_model_args - Other arguments used to call and run the model.
            expected_keys - List of keys that are expected in the output. For this
              method (Occlusion), the expected keys are
              OUTPUT_LAYER_VALUES - Values of the output being
                explained (the logit/softmax value) with respect to the input.
                Outermost dimension should be the same size as x_value_batch.
        call_model_args: The arguments that will be passed to the call model
          function, for every call of the model.
        size: Height and width of the occlusion window. Default is 15.
        value: Value to repalce values inside the occlusion window with. Default
          is 0.
      """
      if len(x_value.shape) > 2:
          occlusion_window = np.zeros([size, size, x_value.shape[2]])
      else:
          occlusion_window = np.zeros([size, size])
      occlusion_window.fill(value)
  
      occlusion_scores = np.zeros_like(x_value)
  
      original_y_value = self.getY(
          x_value, call_model_function, call_model_args
      )
      for row in range(1 + x_value.shape[0] - size):
          for col in range(1 + x_value.shape[1] - size):
              x_occluded = np.array(x_value)
              if len(x_value.shape) > 2:
                  x_occluded[
                      row : row + size, col : col + size, :
                  ] = occlusion_window
              else:
                  x_occluded[
                      row : row + size, col : col + size
                  ] = occlusion_window
  
              y_value = self.getY(
                  x_occluded, call_model_function, call_model_args
              )
  
              score_diff = original_y_value - y_value
              if len(x_value.shape) > 2:
                  occlusion_scores[
                      row : row + size, col : col + size, :
                  ] += score_diff
              else:
                  occlusion_scores[
                      row : row + size, col : col + size
                  ] += score_diff
      return occlusion_scores
  
imports: from .base import CoreSaliency
  from .base import OUTPUT_LAYER_VALUES
  import numpy
label_desc: Use image node_id 2 for calling the Occlusion obj's underlying member method code with example usage: obj.GetMask(x_value, call_model_function, call_model_args, size, value) and returns: occlusion_scores