code: def reduce_logsumexp(
      a, axis=None, keepdims=False, name="reduce_logsumexp"
  ):
      """Like tf.math.reduce_logsumexp.
  
      This has no functional difference from the regular version, except that it's
      implemented inline here, allowing monkey-patching of the special functions it
      uses (e.g. exp).
  
      Args:
        a: A tensor.
        axis: Dimensions to reduce. If `None`, reduces all dimensions.
        keepdims: If `True`, retains the reduced dimensions with length 1.
        name: Name for the op.
  
      Returns:
        y: The reduced tensor.
      """
      with tf.name_scope(name):
          amax_with_dims = tf.math.reduce_max(
              a, axis=axis, keepdims=True
          )
          amax_with_dims = tf.where(
              tf.math.is_finite(amax_with_dims), amax_with_dims, 0
          )
          if keepdims:
              amax = amax_with_dims
          else:
              amax = tf.squeeze(amax_with_dims, axis)
          return amax + tf.math.log(
              tf.math.reduce_sum(
                  tf.math.exp(a - amax_with_dims),
                  axis=axis,
                  keepdims=keepdims,
              )
          )
  
imports: import contextlib
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import custom_gradient
  from tensorflow_probability.python.internal import dtype_util
label_desc: Use image node_id 1 for calling a global function with example usage: reduce_logsumexp(a, axis, keepdims, name) and returns: unknown