code: def _hyp2f1_internal(a, b, c, z):
      """Internal method for Hyp2F1 that decides what recurrence to use."""
      # Make safe for small parameters.
      dtype = dtype_util.common_dtype([a, b, c, z], tf.float32)
      numpy_dtype = dtype_util.as_numpy_dtype(dtype)
      a = tf.convert_to_tensor(a, dtype=dtype)
      b = tf.convert_to_tensor(b, dtype=dtype)
      c = tf.convert_to_tensor(c, dtype=dtype)
      z = tf.convert_to_tensor(z, dtype=dtype)
  
      a_larger = tf.where(tf.math.abs(a) > tf.math.abs(b), b, a)
      b = tf.where(tf.math.abs(a) > tf.math.abs(b), a, b)
      a = a_larger
  
      # If |a| >> |c|, use a recurrence to compute Hyp2f1(a, b, c, z) from
      # Hyp2f1(t, b, c, z), where |t| << |a|.
      recurrence_for_large_a = (
          (tf.math.abs(a) > tf.math.abs(c))
          & (tf.math.abs(c - a) > 2)
          & (tf.math.abs(a) > 2)
      )
  
      # If c is negative and large in magnitude, use a recurrence to
      # compute Hyp2f1(a, b, c, z) from Hyp2f1(a, b, t, z) where t > 0.
      recurrence_for_negative_c = (
          (c < 0.0) & (c < a + b) & (tf.math.abs(c) > 50.0)
      )
  
      unsafe_for_taylor_recurrence = (
          recurrence_for_large_a | recurrence_for_negative_c
      )
  
      small_a = tf.where(
          unsafe_for_taylor_recurrence, numpy_dtype(0.0), a
      )
      small_b = tf.where(
          unsafe_for_taylor_recurrence, numpy_dtype(0.0), b
      )
      small_c = tf.where(
          unsafe_for_taylor_recurrence, numpy_dtype(1.0), c
      )
      result = _hyp2f1_small_parameters(small_a, small_b, small_c, z)
  
      # When c < 0, a, b > 0, use a recurrence to compute Hyp2f1(a, b, c, z). Note
      # that this will also reduce |a| as necessary (since it is likely |a| >> |t|).
      c_negative = tf.where(
          recurrence_for_negative_c, c, numpy_dtype(-1.0)
      )
      safe_a = tf.where(recurrence_for_negative_c, a, numpy_dtype(0.0))
      safe_b = tf.where(recurrence_for_negative_c, b, numpy_dtype(0.0))
      result = tf.where(
          recurrence_for_negative_c,
          _hyp2f1_large_negative_c(safe_a, safe_b, c_negative, z),
          result,
      )
  
      # When |a| >> |c| use a recurrence to simplify.
      small_a = tf.where(recurrence_for_large_a, a, numpy_dtype(0.0))
      result = tf.where(
          recurrence_for_large_a & ~recurrence_for_negative_c,
          _hyp2f1_large_a(small_a, b, c, z),
          result,
      )
  
      return result
  
file_path: probability/tensorflow_probability/python/math/hypergeometric.py
imports: import functools
  import numpy
  import tensorflow.compat.v2
  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 6 for calling a global function with example usage: _hyp2f1_internal(a, b, c, z) and returns: result