code: def log_cumsum_exp(x, axis=-1, name=None):
      """Computes log(cumsum(exp(x))).
  
      This is a pure-TF implementation of `tf.math.cumulative_logsumexp`; unlike
      the built-in op, it supports XLA compilation. It uses a similar algorithmic
      technique (parallel prefix sum) as the built-in op, so it has similar numerics
      and asymptotic performace. However, this implemenentation currently has higher
      overhead, so it is significantly slower on smaller inputs (`n < 10000`).
  
      Args:
        x: the `Tensor` to sum over.
        axis: int `Tensor` axis to sum over.
        name: Python `str` name prefixed to Ops created by this function.
          Default value: `None` (i.e., `'cumulative_logsumexp'`).
      Returns:
        cumulative_logsumexp: `Tensor` of the same shape as `x`.
      """
      with tf.name_scope(name or "cumulative_logsumexp"):
          x = tf.convert_to_tensor(x, name="x")
  
          def safe_logsumexp(x, y):
              result = log_add_exp(x, y)
              # Remove spurious `NaN`s that arise from subtracting infinities.
              return tf.where(
                  tf.math.is_finite(result), result, -np.inf
              )
  
          return scan_associative(safe_logsumexp, x, axis=axis)
  
imports: import collections
  import functools
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import custom_gradient
  from tensorflow_probability.python.internal import distribute_lib
  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.internal import variadic_reduce
  from tensorflow_probability.python.math.scan_associative import scan_associative
  from tensorflow.python.util import deprecation
label_desc: Use image node_id 2 for calling a global function with example usage: log_cumsum_exp(x, axis, name) and returns: scan_associative, tf