code: def _run_forward(
      model: Union[tf.keras.models.Model],
      x: Union[
          List[tf.Tensor], List[np.ndarray], tf.Tensor, np.ndarray
      ],
      target: Union[None, tf.Tensor, np.ndarray, list],
      forward_kwargs: Optional[dict] = None,
  ) -> tf.Tensor:
      """
      Returns the output of the model. If the target is not ``None``, only the output for the selected
      target is returned.
  
      Parameters
      ----------
      model
          `tensorflow` model.
      x
          Input data point.
      target
          Target for which the gradients are calculated for classification models.
      forward_kwargs
          Input keyword args.
  
      Returns
      -------
      Model output or model output after target selection for classification models.
  
      """
      if forward_kwargs is None:
          forward_kwargs = {}
      preds = model(x, **forward_kwargs)
  
      if len(model.output_shape) > 1 and model.output_shape[-1] > 1:
          preds = _select_target(preds, target)
  
      return preds
  
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 3 for calling a global function with example usage: _run_forward(model, x, target, forward_kwargs) and returns: preds