# tf.keras.activations.swish

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v2.13.1/keras/activations.py#L252-L280) |

Swish activation function, `swish(x) = x * sigmoid(x)`.

#### View aliases


**Compat aliases for migration**

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

\`tf.compat.v1.keras.activations.swish\`

<br />

    tf.keras.activations.swish(
        x
    )

Swish activation function which returns `x*sigmoid(x)`.
It is a smooth, non-monotonic function that consistently matches
or outperforms ReLU on deep networks, it is unbounded above and
bounded below.

#### Example Usage:

    a = tf.constant([-20, -1.0, 0.0, 1.0, 20], dtype = tf.float32)
    b = tf.keras.activations.swish(a)
    b.numpy()
    array([-4.1223075e-08, -2.6894143e-01,  0.0000000e+00,  7.3105860e-01,
              2.0000000e+01], dtype=float32)

<br />

<br />

<br />

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

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The swish activation applied to `x` (see reference paper for details). ||

<br />

<br />

<br />

| ## Reference ||
|---|---|
| <br /> - [Ramachandran et al., 2017](https://arxiv.org/abs/1710.05941) ||

<br />