code: def _gradients_input(
      model: Union[tf.keras.models.Model],
      x: List[tf.Tensor],
      target: Union[None, tf.Tensor],
      forward_kwargs: Optional[dict] = None,
  ) -> List[tf.Tensor]:
      """
      Calculates the gradients of the target class output (or the output if the output dimension is equal to 1)
      with respect to each input feature.
  
      Parameters
      ----------
      model
          `tensorflow` model.
      x
          Input data point.
      target
          Target for which the gradients are calculated if the output dimension is higher than 1.
      forward_kwargs
          Input keyword args.
  
      Returns
      -------
      Gradients for each input feature.
  
      """
      if forward_kwargs is None:
          forward_kwargs = {}
      with tf.GradientTape() as tape:
          tape.watch(x)
          preds = _run_forward(
              model, x, target, forward_kwargs=forward_kwargs
          )
  
      grads = tape.gradient(preds, x)
  
      return grads
  
imports: import copy
  import logging
  import string
  import warnings
  from enum import Enum
  from typing import Callable, List, Optional, Tuple, Union, cast
  import numpy
  import tensorflow
  from alibi.api.defaults import DEFAULT_DATA_INTGRAD, DEFAULT_META_INTGRAD
  from alibi.api.interfaces import Explainer, Explanation
  from alibi.utils.approximation_methods import approximation_parameters
label_desc: Use image node_id 7 for calling a global function with example usage: _gradients_input(model, x, target, forward_kwargs) and returns: grads