class_docstr: A CoreSaliency class that computes saliency masks with gradients.
class_docstr_tok: ["A","CoreSaliency","class","that","computes","saliency","masks","with","gradients","."]
docstr: Returns a vanilla gradients 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 (Gradients), the expected keys are
          INPUT_OUTPUT_GRADIENTS - Gradients of the output layer
            (logit/softmax) with respect to the input. Shape should be the
            same shape as x_value_batch.
    call_model_args: The arguments that will be passed to the call model
      function, for every call of the model.
docstr_tok: ["Returns","a","vanilla","gradients","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","(","Gradients",")",",","the","expected","keys","are","INPUT_OUTPUT_GRADIENTS","-","Gradients","of","the","output","layer","(","logit\/softmax",")","with","respect","to","the","input",".","Shape","should","be","the","same","shape","as","x_value_batch",".","call_model_args",":","The","arguments","that","will","be","passed","to","the","call","model","function",",","for","every","call","of","the","model","."]
code: def GetMask(self, x_value, call_model_function, call_model_args=None):
      """Returns a vanilla gradients 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 (Gradients), the expected keys are
              INPUT_OUTPUT_GRADIENTS - Gradients of the output layer
                (logit/softmax) with respect to the input. Shape should be the
                same shape as x_value_batch.
        call_model_args: The arguments that will be passed to the call model
          function, for every call of the model.
      """
      x_value_batched = np.expand_dims(x_value, axis=0)
      call_model_output = call_model_function(
          x_value_batched,
          call_model_args=call_model_args,
          expected_keys=self.expected_keys,
      )
  
      self.format_and_check_call_model_output(
          call_model_output, x_value_batched.shape, self.expected_keys
      )
  
      return call_model_output[INPUT_OUTPUT_GRADIENTS][0]
  
imports: from .base import CoreSaliency
  from .base import INPUT_OUTPUT_GRADIENTS
  import numpy
label_desc: Use image node_id 1 for calling the GradientSaliency obj's underlying member method code with example usage: obj.GetMask(x_value, call_model_function, call_model_args) and returns: call_model_output