# tf_agents.utils.tensor_normalizer.kahan_summation

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/utils/tensor_normalizer.py#L453-L474) |

Calculate stable acculated sum using compensation for low-bits.

    tf_agents.utils.tensor_normalizer.kahan_summation(
        accumulator: https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/Float,
        carry: https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/Float,
        value: https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/Float
    ) -> Tuple[https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/Float, https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/Float]

#### For more details:

<https://en.wikipedia.org/wiki/Kahan_summation_algorithm>

<br />

<br />

<br />

| ## Args ||
|---|---|
| `accumulator` | Accumulator. |
| `carry` | Carry for lost low-order bits. |
| `value` | New value to accumlate. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A tuple `(accumulator, carry)` such that `accumulator` is the new accumulated value and `carry` is the new compensation value. ||

<br />