@@ -72,16 +72,20 @@ class UnaryUfuncRealHBBF16ToFloatHBF16Test : public OperatorTest {
72
72
73
73
auto expected = tf_out.make ({1 , 6 }, expected_vector);
74
74
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
+ }
79
81
EXPECT_TENSOR_CLOSE_WITH_TOL (out, expected, rtol, executorch::runtime::testing::internal::kDefaultBFloat16Atol );
80
82
} 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
+ }
85
89
EXPECT_TENSOR_CLOSE_WITH_TOL (out, expected, rtol, executorch::runtime::testing::internal::kDefaultHalfAtol );
86
90
} else {
87
91
EXPECT_TENSOR_CLOSE (out, expected);
0 commit comments