From 61afee16cd2f1d6be10b579f6f97b8d412cd4ba1 Mon Sep 17 00:00:00 2001 From: Scott Wolchok Date: Tue, 25 Mar 2025 10:05:30 -0700 Subject: [PATCH] Update [ghstack-poisoned] --- .../UnaryUfuncRealHBBF16ToFloatHBF16Test.h | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/kernels/test/UnaryUfuncRealHBBF16ToFloatHBF16Test.h b/kernels/test/UnaryUfuncRealHBBF16ToFloatHBF16Test.h index 6e49dd9e57b..d1e812ec2c2 100644 --- a/kernels/test/UnaryUfuncRealHBBF16ToFloatHBF16Test.h +++ b/kernels/test/UnaryUfuncRealHBBF16ToFloatHBF16Test.h @@ -72,20 +72,16 @@ class UnaryUfuncRealHBBF16ToFloatHBF16Test : public OperatorTest { auto expected = tf_out.make({1, 6}, expected_vector); if (IN_DTYPE == ScalarType::BFloat16 || OUT_DTYPE == ScalarType::BFloat16) { - double rtol = executorch::runtime::testing::internal::kDefaultRtol; - // It appears we need a higher tolerance for at least some ATen - // tests, like aten_op_acosh_test. - if (get_supported_features()->is_aten) { - rtol = 3e-3; - } + // Raise tolerance because both we and ATen run these + // computations at internal float32 precision rather than + // float64. + double rtol = 3e-3; EXPECT_TENSOR_CLOSE_WITH_TOL(out, expected, rtol, executorch::runtime::testing::internal::kDefaultBFloat16Atol); } else if (IN_DTYPE == ScalarType::Half || OUT_DTYPE == ScalarType::Half) { - double rtol = executorch::runtime::testing::internal::kDefaultRtol; - // It appears we need a higher tolerance for at least some ATen - // tests, like aten_op_acosh_test. - if (get_supported_features()->is_aten) { - rtol = 1e-3; - } + // Raise tolerance because both we and ATen run these + // computations at internal float32 precision rather than + // float64. + double rtol = 1e-3; EXPECT_TENSOR_CLOSE_WITH_TOL(out, expected, rtol, executorch::runtime::testing::internal::kDefaultHalfAtol); } else { EXPECT_TENSOR_CLOSE(out, expected);