From 75f2e9c266ec68d202a11ea5514898ccd1735d86 Mon Sep 17 00:00:00 2001 From: Allen Lavoie Date: Fri, 4 Jan 2019 16:51:01 -0800 Subject: [PATCH] Automated rollback of commit 7cc1ff9072ce4c2c7f36b7011e24486071ad13ee PiperOrigin-RevId: 227934767 --- tensorflow/python/framework/constant_op.py | 4 ---- tensorflow/python/kernel_tests/constant_op_test.py | 11 ----------- 2 files changed, 15 deletions(-) diff --git a/tensorflow/python/framework/constant_op.py b/tensorflow/python/framework/constant_op.py index 62a25f3fea2..ade0797dcdb 100644 --- a/tensorflow/python/framework/constant_op.py +++ b/tensorflow/python/framework/constant_op.py @@ -277,10 +277,6 @@ def _constant_impl( (num_t, shape, shape.num_elements())) g = ops.get_default_graph() tensor_value = attr_value_pb2.AttrValue() - if tensor_util.is_tensor(value): - raise ValueError( - ("Cannot create a tf.constant from symbolic Tensor %s. Did you mean " - "tf.convert_to_tensor?") % (value,)) tensor_value.tensor.CopyFrom( tensor_util.make_tensor_proto( value, dtype=dtype, shape=shape, verify_shape=verify_shape, diff --git a/tensorflow/python/kernel_tests/constant_op_test.py b/tensorflow/python/kernel_tests/constant_op_test.py index 2b743ed4c41..583082c2aa2 100644 --- a/tensorflow/python/kernel_tests/constant_op_test.py +++ b/tensorflow/python/kernel_tests/constant_op_test.py @@ -24,7 +24,6 @@ from google.protobuf import text_format from tensorflow.core.framework import graph_pb2 from tensorflow.core.framework import tensor_pb2 -from tensorflow.python.eager import def_function from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes as dtypes_lib from tensorflow.python.framework import errors_impl @@ -631,16 +630,6 @@ class OnesTest(test.TestCase): self.assertEqual([2, 3], z.get_shape()) self.assertAllEqual(z.eval(), np.ones([2, 3])) - @test_util.run_in_graph_and_eager_modes - def testIteratedConstantSensibleException(self): - - @def_function.function - def constant_on_constant(x): - return constant_op.constant(x) - - with self.assertRaisesRegexp(ValueError, "convert_to_tensor"): - constant_on_constant(constant_op.constant(2)) - class OnesLikeTest(test.TestCase):