code: def _von_mises_sample_no_gradient(shape, concentration, seed):
      """Performs rejection sampling for standardized von Mises.
  
      Args:
        shape: The output sample shape.
        concentration: The concentration parameter of the distribution.
        seed: PRNG seed; see `tfp.random.sanitize_seed` for details.
  
      Returns:
        samples: Samples of standardized von Mises.
      """
      r = 1.0 + tf.sqrt(1.0 + 4.0 * concentration**2)
      rho = (r - tf.sqrt(2.0 * r)) / (2.0 * concentration)
  
      s_exact = (1.0 + rho**2) / (2.0 * rho)
  
      # For low concentration, s becomes numerically unstable.
      # To fix that, we use an approximation. Here is the derivation.
      # First-order Taylor expansion at conc = 0 gives
      #   sqrt(1 + 4 concentration^2) ~= 1 + (2 concentration)^2 / 2.
      # Therefore, r ~= 2 + 2 concentration. By plugging this into rho, we have
      #   rho ~= conc + 1 / conc - sqrt(1 + 1 / concentration^2).
      # Let's expand the last term at concentration=0 up to the linear term:
      #   sqrt(1 + 1 / concentration^2) ~= 1 / concentration + concentration / 2
      # Thus, rho ~= concentration / 2. Finally,
      #   s = 1 / (2 rho) + rho / 2 ~= 1 / concentration + concentration / 4.
      # Since concentration is small, we drop the second term and simply use
      #   s ~= 1 / concentration.
      s_approximate = 1.0 / concentration
  
      # To compute the cutoff, we compute s_exact using mpmath with 30 decimal
      # digits precision and compare that to the s_exact and s_approximate
      # computed with dtype. Then, the cutoff is the largest concentration for
      # which abs(s_exact - s_exact_mpmath) > abs(s_approximate - s_exact_mpmath).
      s_concentration_cutoff_dict = {
          tf.float16: 1.8e-1,
          np.float16: 1.8e-1,
          np.finfo(np.float16).dtype: 1.8e-1,
          tf.float32: 2e-2,
          np.float32: 2e-2,
          np.finfo(np.float32).dtype: 2e-2,
          tf.float64: 1.2e-4,
          np.float64: 1.2e-4,
          np.finfo(np.float64).dtype: 1.2e-4,
      }
      s_concentration_cutoff = s_concentration_cutoff_dict[
          concentration.dtype
      ]
  
      s = tf.where(
          concentration > s_concentration_cutoff, s_exact, s_approximate
      )
  
      def loop_body(done, u_in, w, seed):
          """Resample the non-accepted points."""
          # We resample u each time completely. Only its sign is used outside the
          # loop, which is random.
          u_seed, v_seed, next_seed = samplers.split_seed(seed, n=3)
          u = samplers.uniform(
              shape,
              minval=-1.0,
              maxval=1.0,
              dtype=concentration.dtype,
              seed=u_seed,
          )
          tensorshape_util.set_shape(u, u_in.shape)
          z = tf.cos(np.pi * u)
          # Update the non-accepted points.
          w = tf.where(done, w, (1.0 + s * z) / (s + z))
          y = concentration * (s - w)
  
          v = samplers.uniform(
              shape,
              minval=0.0,
              maxval=1.0,
              dtype=concentration.dtype,
              seed=v_seed,
          )
          accept = (y * (2.0 - y) >= v) | (
              tf.math.log(y / v) + 1.0 >= y
          )
  
          return done | accept, u, w, next_seed
  
      _, u, w, _ = tf.while_loop(
          cond=lambda done, *_: ~tf.reduce_all(done),
          body=loop_body,
          loop_vars=(
              tf.zeros(shape, dtype=tf.bool, name="done"),
              tf.zeros(shape, dtype=concentration.dtype, name="u"),
              tf.zeros(shape, dtype=concentration.dtype, name="w"),
              seed,
          ),
          # The expected number of iterations depends on concentration.
          # It monotonically increases from one iteration for concentration = 0 to
          # sqrt(2 pi / e) ~= 1.52 iterations for concentration = +inf [1].
          # We use a limit of 100 iterations to avoid infinite loops
          # for very large / nan concentration.
          maximum_iterations=100,
      )
  
      return tf.sign(u) * tf.math.acos(w)
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import sigmoid
  from tensorflow_probability.python.bijectors import softplus
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import custom_gradient
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.math.gradient import value_and_gradient
label_desc: Use image node_id 6 for calling a global function with example usage: _von_mises_sample_no_gradient(shape, concentration, seed) and returns: unknown, unknown,  u,  w,  next_seed