code: def _olver_asymptotic_uniform(
      v, z, output_log_space=False, name=None
  ):
      """Use Olver's uniform asymptotic expansion for the Bessel function.
  
      Olver's uniform asymptotic expansion [1] is specified by
  
      `I_v(v, v * z) ~ f(a, v) * sum_k U_k(1 / sqrt(1 + z^2)) / v^k`
      `K_v(v, v * z) ~ f(a, v) * sum_k (-1) ** k * U_k(1 / sqrt(1 + z^2)) / v^k`
      where
  
      * `f(a, v) = `exp(v * a) / (sqrt(2 * pi * v) * (1 + z^2)^0.25)`
      * `U_k(z)` are polynomials that are given in [2]. We use the first
      10 polynomials.
  
      #### References
      [1]: Digital Library of Mathematical Functions: https://dlmf.nist.gov/10.41
      [2]: F. Olver, Tables for Bessel Functions of Moderate or Large Orders.
           National Physical Laboratory Mathematical Tables, Vol. 6.
           Department of Scientific and Industrial Research
  
      Args:
        v: value for which `I_{v}(z)` and `K_{v}(z) should be computed.
        z: value for which `I_{v}(z)` and `K_{v}(z) should be computed.
        output_log_space: `bool`. If `True`, output is in log-space.
          Default value: `False`.
        name: A name for the operation (optional).
          Default value: `None` (i.e., 'olver_asymptotic_uniform').
      Returns:
        ive, kve: Asymptotic approximations to the modified bessel functions of the
          first and second kind.
      """
      with tf.name_scope(name or "olver_asymptotic_uniform"):
          v_abs = tf.math.abs(v)
          w = z / v_abs
          t = tf.math.reciprocal(_sqrt1px2(w))
          n_ufactors = len(_ASYMPTOTIC_OLVER_EXPANSION_COEFFICIENTS)
  
          divisor = v_abs
          ive_sum = 1.0
          kve_sum = 1.0
  
          # Note the polynomials have properties of oddness and evenness so that
          # could be taken advantage of when doing evaluation. For simplicity,
          # we naively sum using Horner's method.
          for i in range(n_ufactors):
              coeff = 0.0
              for c in _ASYMPTOTIC_OLVER_EXPANSION_COEFFICIENTS[i]:
                  coeff = coeff * t + c
              term = coeff / divisor
              ive_sum = ive_sum + term
              kve_sum = kve_sum + (term if i % 2 == 1 else -term)
              divisor = divisor * v_abs
  
          # This is modified from the original impl to be more numerically stable
          # since we are subtracting off x.
          shared_prefactor = (
              tf.math.reciprocal(_sqrt1px2(w) + w)
              + tf.math.log(w)
              - tf.math.log1p(tf.math.reciprocal(t))
          )
          log_i_prefactor = (
              0.5 * tf.math.log(t / (2 * np.pi * v_abs))
              + v_abs * shared_prefactor
          )
  
          # Not the same here since they will have the same sign.
          log_k_prefactor = (
              0.5 * tf.math.log(np.pi * t / (2 * v_abs))
              - v_abs * shared_prefactor
          )
  
          log_kve = log_k_prefactor + tf.math.log(kve_sum)
          log_ive = log_i_prefactor + tf.math.log(ive_sum)
  
          # We need to add a correction term for negative v.
          negative_v_correction = log_kve - 2.0 * z
          n = tf.math.round(v)
          u = v - n
          coeff = 2 / np.pi * tf.math.sin(np.pi * u)
          coeff = (1.0 - 2.0 * tf.math.mod(n, 2.0)) * coeff
  
          lse, sign = tfp_math.log_sub_exp(
              log_ive,
              negative_v_correction + tf.math.log(tf.math.abs(coeff)),
              return_sign=True,
          )
          sign = tf.where(coeff < 0.0, sign, 1.0)
  
          log_ive_negative_v = tf.where(
              coeff < 0.0,
              lse,
              tfp_math.log_add_exp(
                  log_ive,
                  negative_v_correction
                  + tf.math.log(tf.math.abs(coeff)),
              ),
          )
  
          if output_log_space:
              log_ive = tf.where(v >= 0.0, log_ive, log_ive_negative_v)
              return log_ive, log_kve
  
          ive = tf.where(
              v >= 0.0,
              tf.math.exp(log_ive),
              sign * tf.math.exp(log_ive_negative_v),
          )
          return ive, tf.math.exp(log_kve)
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import custom_gradient
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.math import generic
label_desc: Use image node_id 10 for calling a global function with example usage: _olver_asymptotic_uniform(v, z, output_log_space, name) and returns: ive,  tf, log_ive,  log_kve