code: def _get_interval_proportion(k, n, q_k, q_kp1, a, b, batch_shape):
      """Calculate the proportion `[a, b)` represents of `[q[i], q[i+1])`."""
      k_valid = tf.greater_equal(k, 0) & tf.less(k + 1, n)
      q_equal = tf.equal(q_kp1, q_k)
      d = tf.where(
          q_equal,
          tf.ones((batch_shape), dtype=q_k.dtype),
          ((b - a) / (q_kp1 - q_k)),
      )
      d = tf.where(k_valid, d, tf.zeros((batch_shape), dtype=q_k.dtype))
  
      # Turn proportions in to probabilities. This is where we assume that
      # the input vectors are quantiles.
      return d / tf.cast(n - 1, d.dtype)
  
file_path: probability/tensorflow_probability/python/stats/ranking.py
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
label_desc: Use image node_id 4 for calling a global function with example usage: _get_interval_proportion(k, n, q_k, q_kp1, a, b, batch_shape) and returns: unknown