code: def _get_endpoint_a(i, j, q1_i, q0_j, batch_shape):
      """Determine the beginning of the interval, `a`."""
      # if i < 0: a = q0[j]
      i_lt_0 = tf.less(i, 0)
      ind = tf.where(i_lt_0)
      a_update = tf.gather_nd(q0_j, ind)
      a = tf.scatter_nd(ind, a_update, batch_shape)
  
      # elif j < 0: a = q1[i]
      j_lt_0 = tf.less(j, 0)
      ind = tf.where(j_lt_0)
      a_update = tf.gather_nd(q1_i, ind)
      a = tf.tensor_scatter_nd_update(a, ind, a_update)
  
      # else: a = max(q0[j], q1[i])
      ind = tf.where(~(i_lt_0 | j_lt_0))
      q_max = tf.maximum(q0_j, q1_i)
      a_update = tf.gather_nd(q_max, ind)
      a = tf.tensor_scatter_nd_update(a, ind, a_update)
      return a
  
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 6 for calling a global function with example usage: _get_endpoint_a(i, j, q1_i, q0_j, batch_shape) and returns: a