code: def _exp_pade_4_4_fwd(
      x,
  ):  # pylint: disable=missing-function-docstring
      x = tf.convert_to_tensor(x, dtype_hint=tf.float32)
      raw_x = x
      dtype = dtype_util.as_numpy_dtype(x.dtype)
      inf = np.float32("inf").astype(dtype)
  
      log2e = np.log(2).astype(dtype)
  
      n = tf.math.floor(x / log2e)
      x = x - n * log2e
  
      coeffs_p = np.array([1 / 1680, 1 / 84, 3 / 28, 1 / 2, 1], dtype)
      coeffs_q = np.array([1 / 1680, -1 / 84, 3 / 28, -1 / 2, 1], dtype)
      res = _horner(x, coeffs_p) / _horner(x, coeffs_q)
  
      if JAX_MODE:
          res = res * jax.numpy.exp2(n)
      else:
          res = res * (2**n)
  
      res = tf.where(tf.equal(raw_x, -inf), tf.zeros_like(x), res)
      res = tf.where(tf.equal(raw_x, inf), inf, res)
      return res, res
  
imports: import contextlib
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import custom_gradient
  from tensorflow_probability.python.internal import dtype_util
label_desc: Use image node_id 4 for calling a global function with example usage: _exp_pade_4_4_fwd(x) and returns: res,  res