Adds eager compatability message for PartitionedVariable.

PiperOrigin-RevId: 173772851
This commit is contained in:
A. Unique TensorFlower 2017-10-28 08:30:04 -07:00 committed by TensorFlower Gardener
parent e7645b6295
commit 0eba15fe63

View File

@ -1053,7 +1053,16 @@ class Variable(object):
class PartitionedVariable(object):
"""A container for partitioned `Variable` objects."""
"""A container for partitioned `Variable` objects.
@compatiblity(eager) `tf.PartitionedVariable` is not compatible with
eager execution. Use `tfe.Variable` instead which is compatable
with both eager execution and graph construction. See [the
TensorFlow Eager Execution
guide](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/eager/python/g3doc/guide.md#variables-and-optimizers)
for details on how variables work in eager execution.
@end_compatiblity
"""
class PartitionedVariableIterator(object):
"""An iterator that allows accessing the underlying `Variable` objects.
@ -1102,10 +1111,11 @@ class PartitionedVariable(object):
`partitions` is not a list.
ValueError: If `variable_list` is empty, or the `Variable` shape
information does not match `shape`, or `partitions` has invalid values.
RuntimeError: If created in EAGER mode.
RuntimeError: If eager execution is enabled
"""
if not context.in_graph_mode():
raise RuntimeError("PartitionedVariable not supported in Eager mode.")
raise RuntimeError("tf.PartitionedVariable not supported in "
"eager mode. Please use tfe.Variable instead")
if not isinstance(variable_list, (list, tuple)):
raise TypeError(
"variable_list is not a list or tuple: %s" % variable_list)