code: def _von_mises_cdf_series(x, concentration, num_terms, dtype):
      """Computes the von Mises CDF and its derivative via series expansion."""
      # Keep the number of terms as a float. It should be a small integer, so
      # exactly representable as a float.
      num_terms = tf.cast(num_terms, dtype=dtype)
  
      def loop_body(n, rn, drn_dconcentration, vn, dvn_dconcentration):
          """One iteration of the series loop."""
  
          denominator = 2.0 * n / concentration + rn
          ddenominator_dk = (
              -2.0 * n / concentration**2 + drn_dconcentration
          )
          rn = 1.0 / denominator
          drn_dconcentration = -ddenominator_dk / denominator**2
  
          multiplier = tf.sin(n * x) / n + vn
          vn = rn * multiplier
          dvn_dconcentration = (
              drn_dconcentration * multiplier + rn * dvn_dconcentration
          )
          n = n - 1.0
  
          return n, rn, drn_dconcentration, vn, dvn_dconcentration
  
      (_, _, _, vn, dvn_dconcentration) = tf.while_loop(
          cond=lambda n, *_: n > 0.0,
          body=loop_body,
          loop_vars=(
              num_terms,  # n
              tf.zeros_like(x, name="rn"),
              tf.zeros_like(x, name="drn_dconcentration"),
              tf.zeros_like(x, name="vn"),
              tf.zeros_like(x, name="dvn_dconcentration"),
          ),
      )
  
      cdf = 0.5 + x / (2.0 * np.pi) + vn / np.pi
      dcdf_dconcentration = dvn_dconcentration / np.pi
  
      # Clip the result to [0, 1].
      cdf_clipped = tf.clip_by_value(cdf, 0.0, 1.0)
      # The clipped values do not depend on concentration anymore, so set their
      # derivative to zero.
      dcdf_dconcentration = dcdf_dconcentration * tf.cast(
          (cdf >= 0.0) & (cdf <= 1.0), dtype
      )
  
      return cdf_clipped, dcdf_dconcentration
  
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 4 for calling a global function with example usage: _von_mises_cdf_series(x, concentration, num_terms, dtype) and returns: cdf_clipped,  dcdf_dconcentration, n,  rn,  drn_dconcentration,  vn,  dvn_dconcentration