<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/activations/activations.py#L402-L413) |

Hyperbolic tangent activation function.

    tf.keras.activations.tanh(
        x
    )

#### It is defined as:

`tanh(x) = sinh(x) / cosh(x)`, i.e.
`tanh(x) = ((exp(x) - exp(-x)) / (exp(x) + exp(-x)))`.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | Input tensor. |

<br />