code: def __init__(
      self, model, data, session=None, batch_size=50, local_smoothing=0
  ):
      # try and import keras and tensorflow
      global tf, keras
      if tf is None:
          import tensorflow as tf
  
          if version.parse(tf.__version__) < version.parse("1.4.0"):
              warnings.warn(
                  "Your TensorFlow version is older than 1.4.0 and not supported."
              )
      if keras is None:
          try:
              from tensorflow import keras
  
              if version.parse(keras.__version__) < version.parse(
                  "2.1.0"
              ):
                  warnings.warn(
                      "Your Keras version is older than 2.1.0 and not supported."
                  )
          except Exception:
              pass
  
      # determine the model inputs and outputs
      self.model = model
      self.model_inputs = _get_model_inputs(model)
      self.model_output = _get_model_output(model)
      assert not isinstance(
          self.model_output, list
      ), "The model output to be explained must be a single tensor!"
      assert (
          len(self.model_output.shape) < 3
      ), "The model output must be a vector or a single value!"
      self.multi_output = True
      if len(self.model_output.shape) == 1:
          self.multi_output = False
  
      # check if we have multiple inputs
      self.multi_input = True
      if not isinstance(self.model_inputs, list):
          self.model_inputs = [self.model_inputs]
      self.multi_input = len(self.model_inputs) > 1
      if isinstance(data, pd.DataFrame):
          data = [data.values]
      if not isinstance(data, list):
          data = [data]
  
      self.data = data
      self._num_vinputs = {}
      self.batch_size = batch_size
      self.local_smoothing = local_smoothing
  
      if not tf.executing_eagerly():
          self.session = _get_session(session)
          self.graph = _get_graph(self)
          # see if there is a keras operation we need to save
          self.keras_phase_placeholder = None
          for op in self.graph.get_operations():
              if "keras_learning_phase" in op.name:
                  self.keras_phase_placeholder = op.outputs[0]
  
      # save the expected output of the model (commented out because self.data could be huge for GradientExpliner)
      # self.expected_value = self.run(self.model_output, self.model_inputs, self.data).mean(0)
  
      if not self.multi_output:
          self.gradients = [None]
      else:
          self.gradients = [
              None for i in range(self.model_output.shape[1])
          ]
  
imports: import warnings
  import numpy
  import pandas
  from packaging import version
  from .._explanation import Explanation
  from ..explainers._explainer import Explainer
  from ..explainers.tf_utils import _get_graph, _get_model_inputs, _get_model_output, _get_session
label_desc: Use image node_id 1 to create a new _TFGradient object from inherited base classes: Explainer with example: obj = _TFGradient(model, data, session, batch_size, local_smoothing)