Clarify docstring: tf.Variable(variable_def) does not add to the graph.

Change: 153680516
This commit is contained in:
A. Unique TensorFlower 2017-04-19 23:25:23 -08:00 committed by TensorFlower Gardener
parent 91e4a19c1b
commit 173a4104ed

View File

@ -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)