aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/framework
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-04-02 10:14:35 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-04-02 10:16:52 -0700
commit136b6095c42f6591c70a9f640598ff8398348b40 (patch)
tree1973d073e0759b84d7deca1f4851de56ae4949e8 /tensorflow/contrib/framework
parent861f7a3ecc3c5ecbc22d2fa731956f4ff0469c25 (diff)
Additional arg scope test that demonstrate how nested arg_scope objects behave.
PiperOrigin-RevId: 191308666
Diffstat (limited to 'tensorflow/contrib/framework')
-rw-r--r--tensorflow/contrib/framework/python/ops/arg_scope_test.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tensorflow/contrib/framework/python/ops/arg_scope_test.py b/tensorflow/contrib/framework/python/ops/arg_scope_test.py
index 7ba9d4ffa9..4c3879d4fc 100644
--- a/tensorflow/contrib/framework/python/ops/arg_scope_test.py
+++ b/tensorflow/contrib/framework/python/ops/arg_scope_test.py
@@ -170,6 +170,30 @@ class ArgScopeTest(test.TestCase):
self.assertTupleEqual(args, func1_args)
self.assertDictEqual(kwargs, func1_kwargs)
+ def testNestedArgScopeObjectCreatedOutsideScopeOverridesArgScope(self):
+
+ def get_scope_object():
+ with arg_scope([func1], a=1, b=None, c=[1]) as sc:
+ return sc
+
+ scope_object = get_scope_object()
+ with arg_scope([func1], b=2, d=10):
+ with arg_scope(scope_object):
+ args, kwargs = func1(0)
+ self.assertTupleEqual(args, (0,))
+ self.assertDictEqual(kwargs, {'a': 1, 'b': None, 'c': [1]})
+
+ def testArgScopeObjectCreatedWithinScopeInheritsArgScope(self):
+ def get_scope_object():
+ with arg_scope([func1], a=1, b=None, c=[1]) as sc:
+ return sc
+
+ with arg_scope([func1], b=2, d=10):
+ with arg_scope(get_scope_object()):
+ args, kwargs = func1(0)
+ self.assertTupleEqual(args, (0,))
+ self.assertDictEqual(kwargs, {'a': 1, 'b': None, 'c': [1], 'd': 10})
+
def testSharedArgScope(self):
func1_args = (0,)
func1_kwargs = {'a': 1, 'b': None, 'c': [1]}