from __future__ import division
from __future__ import print_function
+import numpy as np
+
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
+from tensorflow.python.ops import array_ops
from tensorflow.python.ops import clip_ops
from tensorflow.python.ops import gradient_checker
from tensorflow.python.platform import test
self.assertAllClose(np_ans, tf_ans)
+ 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)
+ with self.test_session(use_gpu=True) as sess:
+ sess.run(x, feed_dict={z: np.zeros((7, 0))})
+
if __name__ == '__main__':
test.main()