@@ -72,16 +72,20 @@ class UnaryUfuncRealHBBF16ToFloatHBF16Test : public OperatorTest {
7272
7373 auto expected = tf_out.make ({1 , 6 }, expected_vector);
7474 if (IN_DTYPE == ScalarType::BFloat16 || OUT_DTYPE == ScalarType::BFloat16) {
75- // Raise tolerance because both we and ATen run these
76- // computations at internal float32 precision rather than
77- // float64.
78- double rtol = 3e-3 ;
75+ double rtol = executorch::runtime::testing::internal::kDefaultRtol ;
76+ // It appears we need a higher tolerance for at least some ATen
77+ // tests, like aten_op_acosh_test.
78+ if (get_supported_features ()->is_aten ) {
79+ rtol = 3e-3 ;
80+ }
7981 EXPECT_TENSOR_CLOSE_WITH_TOL (out, expected, rtol, executorch::runtime::testing::internal::kDefaultBFloat16Atol );
8082 } else if (IN_DTYPE == ScalarType::Half || OUT_DTYPE == ScalarType::Half) {
81- // Raise tolerance because both we and ATen run these
82- // computations at internal float32 precision rather than
83- // float64.
84- double rtol = 1e-3 ;
83+ double rtol = executorch::runtime::testing::internal::kDefaultRtol ;
84+ // It appears we need a higher tolerance for at least some ATen
85+ // tests, like aten_op_acosh_test.
86+ if (get_supported_features ()->is_aten ) {
87+ rtol = 1e-3 ;
88+ }
8589 EXPECT_TENSOR_CLOSE_WITH_TOL (out, expected, rtol, executorch::runtime::testing::internal::kDefaultHalfAtol );
8690 } else {
8791 EXPECT_TENSOR_CLOSE (out, expected);
0 commit comments