aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/framework/constant_op.py
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-08-16 09:45:04 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-16 09:49:50 -0700
commit64dd9f5e3cac4b69c86192f3fe09679d58d57ec3 (patch)
tree124871839c0414f62a789d540dd5cc77f32d898a /tensorflow/python/framework/constant_op.py
parent6be42eea4700f1ff35923cee01f170c6dd48184c (diff)
Add documentation clarifying the differences between tf.fill and tf.constant.
PiperOrigin-RevId: 208998330
Diffstat (limited to 'tensorflow/python/framework/constant_op.py')
-rw-r--r--tensorflow/python/framework/constant_op.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tensorflow/python/framework/constant_op.py b/tensorflow/python/framework/constant_op.py
index b3eb57d067..8fab6528e7 100644
--- a/tensorflow/python/framework/constant_op.py
+++ b/tensorflow/python/framework/constant_op.py
@@ -145,6 +145,17 @@ def constant(value, dtype=None, shape=None, name="Const", verify_shape=False):
[-1. -1. -1.]]
```
+ `tf.constant` differs from `tf.fill` in a few ways:
+
+ * `tf.constant` supports arbitrary constants, not just uniform scalar
+ Tensors like `tf.fill`.
+ * `tf.constant` creates a `Const` node in the computation graph with the
+ exact value at graph construction time. On the other hand, `tf.fill`
+ creates an Op in the graph that is expanded at runtime.
+ * Because `tf.constant` only embeds constant values in the graph, it does
+ not support dynamic shapes based on other runtime Tensors, whereas
+ `tf.fill` does.
+
Args:
value: A constant value (or list) of output type `dtype`.