tf.keras.ops.allclose
Stay organized with collections
Save and categorize content based on your preferences.
Returns True if two arrays are element-wise equal within a tolerance.
tf.keras.ops.allclose(
x1, x2, rtol=1e-05, atol=1e-08, equal_nan=False
)
The tolerance values are positive, typically very small numbers. The
relative difference (rtol * abs(b)) and the absolute difference
atol are added together to compare against the absolute difference
between a and b.
Args |
x1
|
First input tensor.
|
x2
|
Second input tensor.
|
rtol
|
The relative tolerance parameter (see Notes).
|
atol
|
The absolute tolerance parameter (see Notes).
|
equal_nan
|
Whether to compare NaN's as equal. If True, NaN's in
a will be considered equal to NaN's in b in the output array.
|
Returns |
|
True if the two arrays are equal within the given tolerance;
False otherwise.
|
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-10-31 UTC."],[],[]]