-
Notifications
You must be signed in to change notification settings - Fork 75.1k
Closed
Labels
TF 2.0Issues relating to TensorFlow 2.0Issues relating to TensorFlow 2.0TF 2.1for tracking issues in 2.1 releasefor tracking issues in 2.1 releasecomp:opsOPs related issuesOPs related issuesstat:awaiting tensorflowerStatus - Awaiting response from tensorflowerStatus - Awaiting response from tensorflowertype:docs-bugDocument issuesDocument issues
Description
System information
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow):
import tensorflow as tf
a = tf.Variable(2)
a.assign(5)
assert a.numpy() == 5
# ValueError: Shapes () and (2,) are incompatible
a.assign([1,2])
# TypeError: assign() got an unexpected keyword argument 'validate_shape'
a.assign([1,2], validate_shape=False)
# ValueError: Shapes () and (2,) are incompatible
tf.compat.v1.assign(a, [1,2], validate_shape=False)
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10, Linux
- TensorFlow installed from (source or binary): pip
- TensorFlow version (use command below): 2.0.0, 2.1.0
- Python version: 3.7
Describe the current behavior
tf.assign had a validate_shape parameter that Variable.assign seems to be missing.
In addition, the docs say:
If you want to change the shape of a variable later you have to use an
assignOp withvalidate_shape=False.
https://www.tensorflow.org/api_docs/python/tf/Variable
How should one change the shape of a variable?
Code to reproduce the issue
See above.
Metadata
Metadata
Assignees
Labels
TF 2.0Issues relating to TensorFlow 2.0Issues relating to TensorFlow 2.0TF 2.1for tracking issues in 2.1 releasefor tracking issues in 2.1 releasecomp:opsOPs related issuesOPs related issuesstat:awaiting tensorflowerStatus - Awaiting response from tensorflowerStatus - Awaiting response from tensorflowertype:docs-bugDocument issuesDocument issues