Save the original from_proto method before calling it to avoid infinite loop.
authorPriya Gupta <priyag@google.com>
Thu, 5 Apr 2018 19:57:49 +0000 (12:57 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Thu, 5 Apr 2018 20:00:12 +0000 (13:00 -0700)
PiperOrigin-RevId: 191784430

tensorflow/python/training/distribute.py

index c44627e..78bc024 100644 (file)
@@ -1226,13 +1226,16 @@ _default_tower_mode = _DefaultTowerThreadMode()
 # So here we catch any attempts to deserialize variables
 # when using distribution strategies.
 # pylint: disable=protected-access
+_original_from_proto = resource_variable_ops._from_proto_fn
+
+
 def _from_proto_fn(v, import_scope=None):
   if has_distribution_strategy():
     raise NotImplementedError(
         "Deserialization of variables is not yet supported when using"
         "distributed strategies.")
   else:
-    resource_variable_ops._from_proto_fn(v, import_scope=import_scope)
+    return _original_from_proto(v, import_scope=import_scope)
 
 resource_variable_ops._from_proto_fn = _from_proto_fn
 # pylint: enable=protected-access