<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#L65-L85) |

Rectified linear unit activation function with upper bound of 6.

#### View aliases


**Main aliases**

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

<br />

    tf.keras.ops.relu6(
        x
    )

It is defined as `f(x) = np.clip(x, 0, 6)`.

<br />

<br />

<br />

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

<br />

<br />

<br />

<br />

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

<br />

#### Example:

    x = keras.ops.convert_to_tensor([-3.0, -2.0, 0.1, 0.2, 6.0, 8.0])
    keras.ops.relu6(x)
    array([0.0, 0.0, 0.1, 0.2, 6.0, 6.0], dtype=float32)