<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/numpy.py#L8305-L8326) |

Return the truncated value of the input, element-wise.

#### View aliases


**Main aliases**

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

<br />

    tf.keras.ops.trunc(
        x
    )

The truncated value of the scalar `x` is the nearest integer `i` which is
closer to zero than `x` is. In short, the fractional part of the signed
number `x` is discarded.

<br />

<br />

<br />

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

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The truncated value of each element in `x`. ||

<br />

#### Example:

    x = ops.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0])
    ops.trunc(x)
    array([-1.0, -1.0, -0.0, 0.0, 1.0, 1.0, 2.0])