Skip to content

Commit 03987b2

Browse files
zwestricktfx-copybara
authored andcommitted
Fixes test flakiness caused by floating point nondeterminism by allowing some relative tolerance in feature proto comparison.
PiperOrigin-RevId: 651893670
1 parent 7f2e655 commit 03987b2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tensorflow_data_validation/utils/test_util.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ def assert_feature_proto_equal(
157157
del expected.custom_stats[:]
158158

159159
# Compare the rest of the proto without numeric custom stats
160-
compare.assertProtoEqual(test, expected, actual, normalize_numbers=True)
160+
compare.assertProtoEqual(
161+
test, expected, actual, normalize_numbers=True, relative_tolerance=1e-9
162+
)
161163

162164

163165
def assert_dataset_feature_stats_proto_equal(

0 commit comments

Comments
 (0)