From 02448f6ec0147e96dc79dafd685259e0018f1c75 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 15 Apr 2025 23:57:00 -0700 Subject: [PATCH] This change proactively relaxes floating point comparisons in unit tests to avoid breaking them when updating the Eigen library in cl/747497592. Background: The Eigen update contains a number of improvements to the use of fused-multiply-and-add instructions for both float, bfloat16, and float16, as well as changes that may alter summation order in matrix multiplication. While such changes only cause minor numerical changes locally (relative changes on the order of 2^-23, 2^-10, 2^-7, for float, float16, and bfloat16, respectively), such changes may cause sensitive ("ill-conditioned") computations to deviate more significantly, as those small changes propagate. PiperOrigin-RevId: 748177632 --- tf_keras/layers/rnn/time_distributed_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tf_keras/layers/rnn/time_distributed_test.py b/tf_keras/layers/rnn/time_distributed_test.py index 15563ab57..ac43e2352 100644 --- a/tf_keras/layers/rnn/time_distributed_test.py +++ b/tf_keras/layers/rnn/time_distributed_test.py @@ -417,7 +417,7 @@ def test_TimeDistributed_with_ragged_input(self, layer): output_dense = model_2.predict(dense_data, steps=1) output_ragged = convert_ragged_tensor_value(output_ragged) - self.assertAllEqual(output_ragged.to_tensor(), output_dense) + self.assertAllClose(output_ragged.to_tensor(), output_dense) @test_combinations.run_all_keras_modes def test_TimeDistributed_with_ragged_input_with_batch_size(self):