Use test macros for IsInf tests.

Now that the tests are not disabled anymore, we can generate them with the
macros.

PiperOrigin-RevId: 351336136
Change-Id: Icd10d02185cb989bd8265a53d8e44a789f4d1ccc
This commit is contained in:
Adrian Kuegel 2021-01-12 03:20:36 -08:00 committed by TensorFlower Gardener
parent 8f0920289a
commit 9f14841393

View File

@ -254,33 +254,22 @@ GENERATE_DEFAULT_TEST(Imag, DT_COMPLEX128, DT_DOUBLE, baseline_imag,
test::GpuOpsTestConfig().AddTout().NoBufferReuse())
/// Test `tf.IsInf`.
TEST_F(GpuUnaryOpTest, IsInfFloat) {
Test<float, float, bool, bool>(
/*op_name=*/"IsInf", test::DefaultInputShape(),
test::DefaultInput<float>(),
/*baseline_callback=*/std::isinf,
test::GpuOpsTestConfig().ExpectStrictlyEqual().NoBufferReuse());
}
TEST_F(GpuUnaryOpTest, IsInfDouble) {
// Workaround for gcc bug, it would fail with "unresolved overloaded function
// type" if passing std::isinf with type double. So we use type float for
// comparing expected values.
Test<double, float, bool, bool>(
/*op_name=*/"IsInf", test::DefaultInputShape(),
test::DefaultInput<double>(),
/*baseline_callback=*/std::isinf,
test::GpuOpsTestConfig().ExpectStrictlyEqual().NoBufferReuse());
}
GENERATE_DEFAULT_TEST_2(
IsInf, DT_FLOAT, DT_FLOAT, DT_BOOL, DT_BOOL, std::isinf,
test::GpuOpsTestConfig().ExpectStrictlyEqual().NoBufferReuse());
// Workaround for gcc bug, it would fail with "unresolved overloaded function
// type" if passing std::isinf with type double. So we use type float for
// comparing expected values.
GENERATE_DEFAULT_TEST_2(
IsInf, DT_DOUBLE, DT_FLOAT, DT_BOOL, DT_BOOL, std::isinf,
test::GpuOpsTestConfig().ExpectStrictlyEqual().NoBufferReuse());
GENERATE_DEFAULT_TEST_2(
IsInf, DT_HALF, DT_FLOAT, DT_BOOL, DT_BOOL, std::isinf,
test::GpuOpsTestConfig().ExpectStrictlyEqual().NoBufferReuse());
TEST_F(GpuUnaryOpTest, IsInfHalf) {
Test<Eigen::half, float, bool, bool>(
/*op_name=*/"IsInf", test::DefaultInputShape(),
test::DefaultInput<Eigen::half>(),
/*baseline_callback=*/std::isinf,
test::GpuOpsTestConfig().ExpectStrictlyEqual().NoBufferReuse());
}
//
/// Test `tf.Log`.
GENERATE_DEFAULT_TEST_WITH_SPECIFIC_INPUT_VALUES(