Skip to content

Commit a2e898e

Browse files
committed
Revert "relax tolerances for all unary float ops (#9585)"
This reverts commit 2dedc9e.
1 parent 7a2934b commit a2e898e

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

kernels/test/UnaryUfuncRealHBBF16ToFloatHBF16Test.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)