# tf.keras.backend.foldl

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 2 version](https://www.tensorflow.org/api_docs/python/tf/keras/backend/foldl) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/keras/backend.py#L5703-L5717) |

Reduce elems using fn to combine them from left to right.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.keras.backend.foldl`](https://www.tensorflow.org/api_docs/python/tf/keras/backend/foldl), \`tf.compat.v2.keras.backend.foldl\`

<br />

    tf.keras.backend.foldl(
        fn, elems, initializer=None, name=None
    )

<br />

<br />

<br />

| ## Arguments ||
|---|---|
| `fn` | Callable that will be called upon each element in elems and an accumulator, for instance `lambda acc, x: acc + x` |
| `elems` | tensor |
| `initializer` | The first value used (`elems[0]` in case of None) |
| `name` | A string name for the foldl node in the graph |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Tensor with same type and shape as `initializer`. ||

<br />