aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Eugene Brevdo <ebrevdo@google.com>2018-03-28 10:25:27 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-03-28 10:27:28 -0700
commitb1f6c4e0dee8732d8e25262052656e9cdf5ca513 (patch)
tree22049eccdb2f137ee14e20321c33e6e0dce898aa
parent1fe68ce0f4f7ef020cc52d1cc9963dd344fccba0 (diff)
Properly serialize ResourceVariable global_step into the metagraph.
Prior to this, saving and restoring a graph with a resource variable global_step would cause the global_step collection of the reimported graph to contain a resource tensor (the object underlying the ResourceVariable); the actual metadata associated with it would be serialized. PiperOrigin-RevId: 190791443
-rw-r--r--tensorflow/python/ops/resource_variable_ops.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tensorflow/python/ops/resource_variable_ops.py b/tensorflow/python/ops/resource_variable_ops.py
index df873da98e..2f39ea2e7d 100644
--- a/tensorflow/python/ops/resource_variable_ops.py
+++ b/tensorflow/python/ops/resource_variable_ops.py
@@ -1087,6 +1087,11 @@ ops.register_proto_function(
proto_type=variable_pb2.VariableDef,
to_proto=_to_proto_fn,
from_proto=_from_proto_fn)
+ops.register_proto_function(
+ ops.GraphKeys.GLOBAL_STEP,
+ proto_type=variable_pb2.VariableDef,
+ to_proto=_to_proto_fn,
+ from_proto=_from_proto_fn)
def is_resource_variable(var):