class_docstr: Perform gradients backpropagation for a given input
  
  Paper: [Deep Inside Convolutional Networks: Visualising Image Classification
      Models and Saliency Maps](https://arxiv.org/abs/1312.6034)
class_docstr_tok: ["Perform","gradients","backpropagation","for","a","given","input","Paper",":","[","Deep","Inside","Convolutional","Networks",":","Visualising","Image","Classification","Models","and","Saliency","Maps","]","(","https",":","\/\/arxiv.org\/abs\/1312.6034",")"]
docstr: Perform gradients backpropagation for a given input
  
  Args:
      validation_data (Tuple[np.ndarray, Optional[np.ndarray]]): Validation data
          to perform the method on. Tuple containing (x, y).
      score_model (tf.keras.Model): tf.keras model to inspect. The last layer
      should not have any activation function.
      class_index (int): Index of targeted class
  
  Returns:
      numpy.ndarray: Grid of all the gradients
docstr_tok: ["Perform","gradients","backpropagation","for","a","given","input","Args",":","validation_data","(","Tuple","[","np.ndarray",",","Optional","[","np.ndarray","]","]",")",":","Validation","data","to","perform","the","method","on",".","Tuple","containing","(","x",",","y",")",".","score_model","(","tf.keras.Model",")",":","tf.keras","model","to","inspect",".","The","last","layer","should","not","have","any","activation","function",".","class_index","(","int",")",":","Index","of","targeted","class","Returns",":","numpy.ndarray",":","Grid","of","all","the","gradients"]
code: def explain_score_model(
      self, validation_data, score_model, class_index
  ):
      """
      Perform gradients backpropagation for a given input
  
      Args:
          validation_data (Tuple[np.ndarray, Optional[np.ndarray]]): Validation data
              to perform the method on. Tuple containing (x, y).
          score_model (tf.keras.Model): tf.keras model to inspect. The last layer
          should not have any activation function.
          class_index (int): Index of targeted class
  
      Returns:
          numpy.ndarray: Grid of all the gradients
      """
      images, _ = validation_data
  
      gradients = self.compute_gradients(
          images, score_model, class_index
      )
  
      grayscale_gradients = transform_to_normalized_grayscale(
          tf.abs(gradients)
      ).numpy()
  
      grid = grid_display(grayscale_gradients)
  
      return grid
  
file_path: tf-explain/tf_explain/core/vanilla_gradients.py
imports: from warnings import warn
  import tensorflow
  from tf_explain.utils.display import grid_display
  from tf_explain.utils.image import transform_to_normalized_grayscale
  from tf_explain.utils.saver import save_grayscale
label_desc: Use image node_id 4 for calling the VanillaGradients obj's underlying member method code with example usage: obj.explain_score_model(validation_data, score_model, class_index) and returns: grid