tf.keras.ops.trunc
Stay organized with collections
Save and categorize content based on your preferences.
Return the truncated value of the input, element-wise.
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.
Returns |
The truncated value of each element in x.
|
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])
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2026-10-31 UTC.
[null,null,["Last updated 2026-10-31 UTC."],[],[]]