class_docstr: Interprets the prediction using Integrated Gradients (https://arxiv.org/abs/1703.01365)
  
  Registered as a `SaliencyInterpreter` with name "integrated-gradient".
class_docstr_tok: ["Interprets","the","prediction","using","Integrated","Gradients","(","https",":","\/\/arxiv.org\/abs\/1703.01365",")","Registered","as","a","`","SaliencyInterpreter","`","with","name","``","integrated-gradient","''","."]
code: def saliency_interpret_from_json(self, inputs: JsonDict) -> JsonDict:
      # Convert inputs to labeled instances
      labeled_instances = self.predictor.json_to_labeled_instances(
          inputs
      )
  
      instances_with_grads = dict()
      for idx, instance in enumerate(labeled_instances):
          # Run integrated gradients
          grads = self._integrate_gradients(instance)
  
          # Normalize results
          for key, grad in grads.items():
              # The [0] here is undo-ing the batching that happens in get_gradients.
              embedding_grad = numpy.sum(grad[0], axis=1)
              norm = numpy.linalg.norm(embedding_grad, ord=1)
              normalized_grad = [
                  math.fabs(e) / norm for e in embedding_grad
              ]
              grads[key] = normalized_grad
  
          instances_with_grads["instance_" + str(idx + 1)] = grads
  
      return sanitize(instances_with_grads)
  
file_path: allennlp/allennlp/interpret/saliency_interpreters/integrated_gradient.py
imports: import math
  from typing import List, Dict, Any
  import numpy
  import torch
  from allennlp.common.util import JsonDict, sanitize
  from allennlp.data import Instance
  from allennlp.interpret.saliency_interpreters.saliency_interpreter import SaliencyInterpreter
  from allennlp.nn import util
label_desc: Use image node_id 1 for calling the IntegratedGradient obj's underlying member method code with example usage: obj.saliency_interpret_from_json(inputs) and returns: sanitize