aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/training/slot_creator.py
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-08-28 11:41:04 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-08-28 11:48:38 -0700
commit95d240c5fbecec9fdbef55dc1154c4f454752633 (patch)
tree117a2b52af4ed1df28c2094f959a9098d87bd34d /tensorflow/python/training/slot_creator.py
parent2a6c8897f59e2cbf943f52b222a1968fa7e2f158 (diff)
Fix Adam in Eager mode and test adam/momentum
PiperOrigin-RevId: 166733547
Diffstat (limited to 'tensorflow/python/training/slot_creator.py')
-rw-r--r--tensorflow/python/training/slot_creator.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/tensorflow/python/training/slot_creator.py b/tensorflow/python/training/slot_creator.py
index 4371e92bd3..ea28b5ddfc 100644
--- a/tensorflow/python/training/slot_creator.py
+++ b/tensorflow/python/training/slot_creator.py
@@ -39,6 +39,7 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
+from tensorflow.python.eager import context
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import init_ops
@@ -139,7 +140,8 @@ def create_slot_with_initializer(primary, initializer, shape, dtype, name,
# and the same name has been previously used, the scope name will add '_N'
# as suffix for unique identifications.
validate_shape = shape.is_fully_defined()
- with variable_scope.variable_scope(None, primary.op.name + "/" + name):
+ prefix = primary.op.name if context.in_graph_mode() else primary._shared_name # pylint: disable=protected-access
+ with variable_scope.variable_scope(None, prefix + "/" + name):
if colocate_with_primary:
with ops.colocate_with(primary):
return _create_slot_var(primary, initializer, "", validate_shape, shape,