aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/framework/constant_op.py
diff options
context:
space:
mode:
authorGravatar Andrew Harp <andrewharp@google.com>2016-12-08 20:05:49 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-12-08 20:21:45 -0800
commit1cb96893a64f59b7265f9def9968f7bed1e57662 (patch)
tree0e6d595a0806028f5f92e64c84342ae9659ca108 /tensorflow/python/framework/constant_op.py
parent90b72f4b2f07a0126efb110d8d4cc96386fcc968 (diff)
Merge changes from github.
Additionally: - change single quotes to double quotes to make path rewriting easier - guard windows lib reference with PLATFORM_WINDOWS - fixed failing kmeans test Change: 141515942
Diffstat (limited to 'tensorflow/python/framework/constant_op.py')
-rw-r--r--tensorflow/python/framework/constant_op.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/tensorflow/python/framework/constant_op.py b/tensorflow/python/framework/constant_op.py
index f06b477bc8..3bcc537779 100644
--- a/tensorflow/python/framework/constant_op.py
+++ b/tensorflow/python/framework/constant_op.py
@@ -114,7 +114,7 @@ from tensorflow.python.framework import tensor_shape
from tensorflow.python.framework import tensor_util
-def constant(value, dtype=None, shape=None, name="Const"):
+def constant(value, dtype=None, shape=None, name="Const", verify_shape=False):
"""Creates a constant tensor.
The resulting tensor is populated with values of type `dtype`, as
@@ -146,13 +146,15 @@ def constant(value, dtype=None, shape=None, name="Const"):
```
Args:
- value: A constant value (or list) of output type `dtype`.
+ value: A constant value (or list) of output type `dtype`.
- dtype: The type of the elements of the resulting tensor.
+ dtype: The type of the elements of the resulting tensor.
- shape: Optional dimensions of resulting tensor.
+ shape: Optional dimensions of resulting tensor.
- name: Optional name for the tensor.
+ name: Optional name for the tensor.
+
+ verify_shape: Boolean that enables verification of a shape of values.
Returns:
A Constant Tensor.
@@ -160,7 +162,7 @@ def constant(value, dtype=None, shape=None, name="Const"):
g = ops.get_default_graph()
tensor_value = attr_value_pb2.AttrValue()
tensor_value.tensor.CopyFrom(
- tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape))
+ tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape))
dtype_value = attr_value_pb2.AttrValue(type=tensor_value.tensor.dtype)
const_tensor = g.create_op(
"Const", [], [dtype_value.type],