Skip to content

relax tolerances for all unary float ops #9585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: gh/swolchok/386/head
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions kernels/test/UnaryUfuncRealHBBF16ToFloatHBF16Test.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading