aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/ops
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-10-01 03:27:05 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-10-01 03:32:14 -0700
commitc1c63c936c4bc51b401b82fbe54ed1945f49a314 (patch)
treee22bd585fb4451c1a71d9c6080683edd2ec957d2 /tensorflow/python/ops
parent0fd21d8c34e15bc3013e93014d101b672e1f3687 (diff)
Moves the creation of regularizer ops in get_variable out of surrounding context.
This resembles the behaviour for initializer ops. PiperOrigin-RevId: 215187942
Diffstat (limited to 'tensorflow/python/ops')
-rw-r--r--tensorflow/python/ops/variable_scope.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tensorflow/python/ops/variable_scope.py b/tensorflow/python/ops/variable_scope.py
index af5c7d4050..5032ca79f9 100644
--- a/tensorflow/python/ops/variable_scope.py
+++ b/tensorflow/python/ops/variable_scope.py
@@ -939,7 +939,8 @@ class _VariableStore(object):
if regularizer:
with ops.colocate_with(v):
with ops.name_scope(name + "/Regularizer/"):
- loss = regularizer(v)
+ with ops.init_scope():
+ loss = regularizer(v)
if loss is not None:
if context.executing_eagerly():
v_name = "v_%s" % type(v)