Iterate over a copy of dictionary keys when closing variable subscopes. Otherwise...
authorPriya Gupta <priyag@google.com>
Wed, 4 Apr 2018 22:15:32 +0000 (15:15 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Wed, 4 Apr 2018 22:20:23 +0000 (15:20 -0700)
PiperOrigin-RevId: 191655599

tensorflow/python/ops/variable_scope.py

index c35735c..e33085b 100644 (file)
@@ -1164,7 +1164,7 @@ class _VariableScopeStore(threading.local):
       self.variable_scopes_count[scope_name] = 1
 
   def close_variable_subscopes(self, scope_name):
-    for k in self.variable_scopes_count:
+    for k in list(self.variable_scopes_count.keys()):
       if not scope_name or k.startswith(scope_name + "/"):
         self.variable_scopes_count[k] = 0