parent
84bddea010
commit
75f2e9c266
@ -277,10 +277,6 @@ def _constant_impl(
|
|||||||
(num_t, shape, shape.num_elements()))
|
(num_t, shape, shape.num_elements()))
|
||||||
g = ops.get_default_graph()
|
g = ops.get_default_graph()
|
||||||
tensor_value = attr_value_pb2.AttrValue()
|
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_value.tensor.CopyFrom(
|
||||||
tensor_util.make_tensor_proto(
|
tensor_util.make_tensor_proto(
|
||||||
value, dtype=dtype, shape=shape, verify_shape=verify_shape,
|
value, dtype=dtype, shape=shape, verify_shape=verify_shape,
|
||||||
|
@ -24,7 +24,6 @@ from google.protobuf import text_format
|
|||||||
|
|
||||||
from tensorflow.core.framework import graph_pb2
|
from tensorflow.core.framework import graph_pb2
|
||||||
from tensorflow.core.framework import tensor_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 constant_op
|
||||||
from tensorflow.python.framework import dtypes as dtypes_lib
|
from tensorflow.python.framework import dtypes as dtypes_lib
|
||||||
from tensorflow.python.framework import errors_impl
|
from tensorflow.python.framework import errors_impl
|
||||||
@ -631,16 +630,6 @@ class OnesTest(test.TestCase):
|
|||||||
self.assertEqual([2, 3], z.get_shape())
|
self.assertEqual([2, 3], z.get_shape())
|
||||||
self.assertAllEqual(z.eval(), np.ones([2, 3]))
|
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):
|
class OnesLikeTest(test.TestCase):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user