diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2017-04-19 23:25:23 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-04-20 00:51:34 -0700 |
commit | 173a4104edfc5a2e81aff0684607f29c00f417c8 (patch) | |
tree | 62fdcfb96123037c270977d507e36872f4ae7261 | |
parent | 91e4a19c1bbded4430299c636486c86b3fff2ab9 (diff) |
Clarify docstring: tf.Variable(variable_def) does not add to the graph.
Change: 153680516
-rw-r--r-- | tensorflow/python/ops/variables.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tensorflow/python/ops/variables.py b/tensorflow/python/ops/variables.py index 4793cb4a17..8b508e45a4 100644 --- a/tensorflow/python/ops/variables.py +++ b/tensorflow/python/ops/variables.py @@ -163,8 +163,9 @@ class Variable(object): name: Optional name for the variable. Defaults to `'Variable'` and gets uniquified automatically. variable_def: `VariableDef` protocol buffer. If not `None`, recreates - the Variable object with its contents. `variable_def` and the other - arguments are mutually exclusive. + the Variable object with its contents, referencing the variable's nodes + in the graph, which must already exist. The graph is not changed. + `variable_def` and the other arguments are mutually exclusive. dtype: If set, initial_value will be converted to the given type. If `None`, either the datatype will be kept (if `initial_value` is a Tensor), or `convert_to_tensor` will decide. @@ -320,10 +321,11 @@ class Variable(object): self._save_slice_info = None def _init_from_proto(self, variable_def, import_scope=None): - """Creates a new variable from `VariableDef` protocol buffer. + """Recreates the Variable object from a `VariableDef` protocol buffer. Args: - variable_def: `VariableDef` protocol buffer. + variable_def: `VariableDef` protocol buffer, describing a variable + whose nodes already exists in the graph. import_scope: Optional `string`. Name scope to add. """ assert isinstance(variable_def, variable_pb2.VariableDef) |