Update test case to cover all scenarios
authorYong Tang <yong.tang.github@outlook.com>
Fri, 18 May 2018 17:59:31 +0000 (17:59 +0000)
committerYong Tang <yong.tang.github@outlook.com>
Fri, 18 May 2018 18:00:28 +0000 (18:00 +0000)
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
tensorflow/python/kernel_tests/clip_ops_test.py

index 5b8b5d0..fb52d10 100644 (file)
@@ -419,11 +419,13 @@ class ClipTest(test.TestCase):
 
   def testClipByValueEmptyTensor(self):
     # Test case for GitHub issue 19337
-    z = array_ops.placeholder(dtype=dtypes.float32, shape=None)
-    x = clip_ops.clip_by_value(z, z, 1)
-    y = clip_ops.clip_by_value(z, 1, z)
+    zero = array_ops.placeholder(dtype=dtypes.float32, shape=None)
+    x = clip_ops.clip_by_value(zero, zero, zero)
+    y = clip_ops.clip_by_value(zero, 1.0, 1.0)
+    z = clip_ops.clip_by_value(zero, zero, 1.0)
+    w = clip_ops.clip_by_value(zero, 1.0, zero)
     with self.test_session(use_gpu=True) as sess:
-      sess.run([x, y], feed_dict={z: np.zeros((7, 0))})
+      sess.run([x, y, z, w], feed_dict={zero: np.zeros((7, 0))})
 
 
 if __name__ == '__main__':