From 3897e02fc9e01178ca6c9d0f02e1e58c51753e5b Mon Sep 17 00:00:00 2001 From: Gaurav Jain Date: Thu, 4 Jun 2020 08:52:33 -0700 Subject: [PATCH] Enable disabled clip_by_value tests Most of the disabled tests were trying to test with int8 & uint16 which is not supported by the Minimum and Maximum kernel. PiperOrigin-RevId: 314737076 Change-Id: Iee39aae6d95a9a7f18bdcde5a406e60c70466cb6 --- .../python/kernel_tests/clip_ops_test.py | 47 ++++++++++++++----- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/tensorflow/python/kernel_tests/clip_ops_test.py b/tensorflow/python/kernel_tests/clip_ops_test.py index 433ec689375..f6523b9b094 100644 --- a/tensorflow/python/kernel_tests/clip_ops_test.py +++ b/tensorflow/python/kernel_tests/clip_ops_test.py @@ -34,7 +34,8 @@ from tensorflow.python.platform import test class ClipTest(test.TestCase): - def DISABLED_testClipByValueGradient(self): + @test_util.run_deprecated_v1 + def testClipByValueGradient(self): inputs = constant_op.constant([1.0, 2.0, 3.0, 4.0], dtype=dtypes.float32) outputs_1 = clip_ops.clip_by_value(inputs, 0.5, 3.5) min_val = constant_op.constant([0.5, 0.5, 0.5, 0.5], dtype=dtypes.float32) @@ -61,10 +62,15 @@ class ClipTest(test.TestCase): self.assertAllClose(np_ans, tf_ans) # [Tensor, Scalar, Scalar] - def DISABLED_testClipByValue0Type(self): + def testClipByValue0Type(self): for dtype in [ - dtypes.float16, dtypes.float32, dtypes.float64, dtypes.int8, - dtypes.int16, dtypes.int32, dtypes.int64, dtypes.uint8, dtypes.uint16 + dtypes.float16, + dtypes.float32, + dtypes.float64, + dtypes.int16, + dtypes.int32, + dtypes.int64, + dtypes.uint8, ]: with self.cached_session(use_gpu=True): x = constant_op.constant([1, 2, 3, 4, 5, 6], shape=[2, 3], dtype=dtype) @@ -77,10 +83,15 @@ class ClipTest(test.TestCase): self.assertAllClose(np_ans, tf_ans) # [Tensor, Tensor, Scalar] - def DISABLED_testClipByValue1Type(self): + def testClipByValue1Type(self): for dtype in [ - dtypes.float16, dtypes.float32, dtypes.float64, dtypes.int8, - dtypes.int16, dtypes.int32, dtypes.int64, dtypes.uint8, dtypes.uint16 + dtypes.float16, + dtypes.float32, + dtypes.float64, + dtypes.int16, + dtypes.int32, + dtypes.int64, + dtypes.uint8, ]: with self.cached_session(use_gpu=True): x = constant_op.constant([1, 2, 3, 4, 5, 6], shape=[2, 3], dtype=dtype) @@ -94,10 +105,15 @@ class ClipTest(test.TestCase): self.assertAllClose(np_ans, tf_ans) # [Tensor, Scalar, Tensor] - def DISABLED_testClipByValue2Type(self): + def testClipByValue2Type(self): for dtype in [ - dtypes.float16, dtypes.float32, dtypes.float64, dtypes.int8, - dtypes.int16, dtypes.int32, dtypes.int64, dtypes.uint8, dtypes.uint16 + dtypes.float16, + dtypes.float32, + dtypes.float64, + dtypes.int16, + dtypes.int32, + dtypes.int64, + dtypes.uint8, ]: with self.cached_session(use_gpu=True): x = constant_op.constant([1, 2, 3, 4, 5, 6], shape=[2, 3], dtype=dtype) @@ -111,10 +127,15 @@ class ClipTest(test.TestCase): self.assertAllClose(np_ans, tf_ans) # [Tensor, Tensor, Tensor] - def DISABLED_testClipByValue3Type(self): + def testClipByValue3Type(self): for dtype in [ - dtypes.float16, dtypes.float32, dtypes.float64, dtypes.int8, - dtypes.int16, dtypes.int32, dtypes.int64, dtypes.uint8, dtypes.uint16 + dtypes.float16, + dtypes.float32, + dtypes.float64, + dtypes.int16, + dtypes.int32, + dtypes.int64, + dtypes.uint8, ]: with self.cached_session(use_gpu=True): x = constant_op.constant([1, 2, 3, 4, 5, 6], shape=[2, 3], dtype=dtype)