code: def phi_symbolic(self, i):
          
          if self.phi_symbolics[i] is None:
  
              # replace the gradients for all the non-linear activations
              # we do this by hacking our way into the registry (TODO: find a public API for this if it exists)
              reg = tf_ops._gradient_registry._registry
              for n in op_handlers:
                  if n in reg:
                      self.orig_grads[n] = reg[n]["type"]
                      if op_handlers[n] is not passthrough:
                          reg[n]["type"] = self.custom_grad
                  elif n in self.used_types:
                      raise Exception(n + " was used in the model but is not in the gradient registry!")
              # In TensorFlow 1.10 they started pruning out nodes that they think can't be backpropped
              # unfortunately that includes the index of embedding layers so we disable that check here
              if hasattr(tf_gradients_impl, "_IsBackpropagatable"):
                  orig_IsBackpropagatable = tf_gradients_impl._IsBackpropagatable
                  tf_gradients_impl._IsBackpropagatable = lambda tensor: True
              
              # define the computation graph for the attribution values using custom a gradient-like computation
              try:
                  out = self.model_output[:,i] if self.multi_output else self.model_output
                  self.phi_symbolics[i] = tf.gradients(out, self.model_inputs)
  
              finally:
  
                  # reinstate the backpropagatable check
                  if hasattr(tf_gradients_impl, "_IsBackpropagatable"):
                      tf_gradients_impl._IsBackpropagatable = orig_IsBackpropagatable
  
                  # restore the original gradient definitions
                  for n in op_handlers:
                      if n in reg:
                          reg[n]["type"] = self.orig_grads[n]
          return self.phi_symbolics[i]
docs: Get the SHAP value computation graph for a given model output.