diff --git a/tensorflow/compiler/xla/tests/exhaustive_op_test.cc b/tensorflow/compiler/xla/tests/exhaustive_op_test.cc index b409eee87d89a10d2dc4611911780697745df06b..66451a563376c9989e405cefb975bbea610fb3e7 100644 --- a/tensorflow/compiler/xla/tests/exhaustive_op_test.cc +++ b/tensorflow/compiler/xla/tests/exhaustive_op_test.cc @@ -486,6 +486,15 @@ XLA_TEST_P(ExhaustiveOpTest, Log) { Run(Log, std::log); } +XLA_TEST_P(ExhaustiveOpTest, Log1p) { + if (platform_ != "Host" && platform_ != "CUDA" && ty_ == F32) { + abs_err_ = 0.001; + rel_err_ = 0.001; + } + + Run(Log1p, std::log1p); +} + XLA_TEST_P(ExhaustiveOpTest, Exp) { if (platform_ == "Host" && ty_ == F32) { // TODO(b/73142289): The vectorized Exp implementation gives results outside @@ -504,6 +513,25 @@ XLA_TEST_P(ExhaustiveOpTest, Exp) { Run(Exp, std::exp); } +XLA_TEST_P(ExhaustiveOpTest, Expm1) { + // Expm1 has the same erroneous behavior on CPU as Exp. + if (platform_ == "Host" && ty_ == F32) { + // TODO(b/73142289): The vectorized Exp implementation gives results outside + // our error spec in this range. + known_incorrect_begin_ = 1107296256 + 11583654; + known_incorrect_end_ = 1107296256 + 11629080; + } else if (platform_ == "Host" && ty_ == BF16) { + // TODO(jlebar): Is this a rounding error? Why doesn't it occur on XLA:GPU? + // + // Mismatch on 88.5 (0x42b1). + // Expected 2.72491739e+38 (0x7f4d), but got inf (0x7f80). + known_incorrect_begin_ = 0x42b1; + known_incorrect_end_ = 0x42b2; + } + + Run(Expm1, std::expm1); +} + // It feels a little overkill to exhaustively test sqrt and pow(x, 0.5), but // this *did* find a bug, namely that some backends were assuming sqrt(x) == // pow(x, 0.5), but this is not true for x == -inf.