code: def reduce_kahan_sum(
      input_tensor, axis=None, keepdims=False, name=None
  ):
      """Reduces the input tensor along the given axis using Kahan summation.
  
      Returns both the total and the correction term, as a `namedtuple`,
      representing the sum in higher precision as `total - correction`.
  
      A practical use-case is computing the difference of two large (magnitude) sums
      we expect to be nearly equal. If instead we take their difference as
      `(s0.total - s1.total) - (s0.correction - s1.correction)`, we can retain more
      precision in computing their difference.
  
      Note that `total` holds all the high-order bits of the sum, so the correction
      can be safely neglected if further enhanced precision computations are not
      required.
  
      Note: (TF + JAX) This function does not work properly on XLA:CPU without the
      environment variable: `XLA_FLAGS=--xla_cpu_enable_fast_math=false`, due to
      LLVM's reassociation optimizations, which simplify error terms to zero.
  
      Args:
        input_tensor: The tensor to sum.
        axis: One of `None`, a Python `int`, or a sequence of Python `int`. The axes
          to be reduced. `None` is taken as "reduce all axes".
        keepdims: Python `bool` indicating whether we return a tensor with singleton
          dimensions in the reduced axes (`True`), or squeeze the axes out (default,
          `False`).
        name: Optional name for ops in scope.
  
      Returns:
        reduced: A `Kahan(total, correction)` namedtuple.
      """
      with tf.name_scope(name or "reduce_kahan_sum"):
          t = tf.convert_to_tensor(input_tensor)
          operands = (t, tf.zeros_like(t))
          inits = (tf.zeros([], dtype=t.dtype),) * 2
          return Kahan._make(
              _reduce_kahan_sum(
                  operands, inits, axis=axis, keepdims=keepdims
              )
          )
  
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 6 for calling a global function with example usage: reduce_kahan_sum(input_tensor, axis, keepdims, name) and returns: Kahan