<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/ops/nn.py#L558-L583) |

Exponential Linear Unit activation function.

#### View aliases


**Main aliases**

[`tf.keras.ops.nn.elu`](https://www.tensorflow.org/api_docs/python/tf/keras/ops/elu)

<br />

    tf.keras.ops.elu(
        x, alpha=1.0
    )

#### It is defined as:

`f(x) = alpha * (exp(x) - 1.) for x < 0`, `f(x) = x for x >= 0`.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | Input tensor. |
| `alpha` | A scalar, slope of positive section. Defaults to `1.0`. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A tensor with the same shape as `x`. ||

<br />

#### Example:

    x = np.array([-1., 0., 1.])
    x_elu = keras.ops.elu(x)
    print(x_elu)
    array([-0.63212055, 0., 1.], shape=(3,), dtype=float64)