code: def empirical_cdfs(
      samples,
      positions,
      continuity="right",
      dtype=tf.float32,
      name=None,
  ):
      """Evaluates the empirical CDF of a batch of samples at a batch of positions.
  
      If elements of `positions` might be exactly equal to elements of `samples`
      (e.g., if the underlying distribution of interest is discrete), there is a
      difference between the conventional, right-continuous CDF (Pr[X <= x]) and a
      left-continuous variant (Pr[X < x]).  The latter can be accessed by setting
      `continuity='left'`.  The difference between the right-continuous and
      left-continuous CDFs is the empirical pmf at each point, i.e., how many times
      each element of `positions` occurs in its batch of `samples`.
  
      Note: Returns results parallel to `positions`, i.e., the values of the
      empirical CDF at those points.
  
      Note: The samples must be _sorted_ within each batch.
  
      Args:
        samples: Tensor of shape `[num_samples] + batch` of samples.  The samples
          must be in ascending order within each batch member.
        positions: Tensor of shape `[m] + batch` of positions where to evaluate the
          CDFs.  The positions need not be sorted.
        continuity: Whether to return a conventional, right-continuous CDF
          (`continuity = 'right'`, default) or a left-continuous CDF (`continuity =
          'left'`).  The value at each point `x` will be `F_n(X <= x)` or
          `F_n(X < x)`, respectively.
        dtype: dtype at which to evaluate the desired empirical CDFs.
        name: A name for this operation (optional).
  
      Returns:
        cdf: Tensor parallel to `positions`.  For each x in `positions`, gives the
          (right- or left-continuous, per the `continuity` argument) cdf at that
          position.  If `positions` contains duplicates, `cdf` will give each the
          same value.
      """
      # Move the batch dimension of `samples` and `positions` to the rightmost
      # position, where tf.searchsorted wants it.
      samples = distribution_util.move_dimension(samples, 0, -1)
      positions = distribution_util.move_dimension(positions, 0, -1)
  
      if continuity not in ["left", "right"]:
          msg = 'Continuity value must be "left" or "right", got {}.'.format(
              continuity
          )
          raise ValueError(msg)
      with tf.name_scope(name or "empirical_cdfs"):
          n = tf.cast(tf.shape(samples)[-1], dtype=dtype)
          indexes = tf.searchsorted(
              sorted_sequence=samples, values=positions, side=continuity
          )
          result = tf.cast(indexes, dtype=dtype) / n
          return distribution_util.move_dimension(result, -1, 0)
  
imports: import functools
  import itertools
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.util.seed_stream import SeedStream
label_desc: Use image node_id 8 for calling a global function with example usage: empirical_cdfs(samples, positions, continuity, dtype, name) and returns: distribution_util