From 9f148413931a2931d2b24ec35159fd4d5443097d Mon Sep 17 00:00:00 2001 From: Adrian Kuegel Date: Tue, 12 Jan 2021 03:20:36 -0800 Subject: [PATCH] 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 --- .../mlir_generated/gpu_unary_ops_test.cc | 39 +++++++------------ 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/tensorflow/core/kernels/mlir_generated/gpu_unary_ops_test.cc b/tensorflow/core/kernels/mlir_generated/gpu_unary_ops_test.cc index a90eff967e9..530a0002417 100644 --- a/tensorflow/core/kernels/mlir_generated/gpu_unary_ops_test.cc +++ b/tensorflow/core/kernels/mlir_generated/gpu_unary_ops_test.cc @@ -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( - /*op_name=*/"IsInf", test::DefaultInputShape(), - test::DefaultInput(), - /*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( - /*op_name=*/"IsInf", test::DefaultInputShape(), - test::DefaultInput(), - /*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( - /*op_name=*/"IsInf", test::DefaultInputShape(), - test::DefaultInput(), - /*baseline_callback=*/std::isinf, - test::GpuOpsTestConfig().ExpectStrictlyEqual().NoBufferReuse()); -} -// /// Test `tf.Log`. GENERATE_DEFAULT_TEST_WITH_SPECIFIC_INPUT_VALUES(