Expose tf.contrib.framework.current_arg_scope()
PiperOrigin-RevId: 172922818
This commit is contained in:
parent
54503483ef
commit
e65fbbc9dc
@ -37,6 +37,7 @@ See the @{$python/contrib.framework} guide.
|
||||
|
||||
@@arg_scope
|
||||
@@add_arg_scope
|
||||
@@current_arg_scope
|
||||
@@has_arg_scope
|
||||
@@arg_scoped_arguments
|
||||
|
||||
|
@ -67,6 +67,7 @@ from tensorflow.python.util import tf_decorator
|
||||
|
||||
__all__ = ['arg_scope',
|
||||
'add_arg_scope',
|
||||
'current_arg_scope',
|
||||
'has_arg_scope',
|
||||
'arg_scoped_arguments']
|
||||
|
||||
@ -83,7 +84,7 @@ def _get_arg_stack():
|
||||
return _ARGSTACK
|
||||
|
||||
|
||||
def _current_arg_scope():
|
||||
def current_arg_scope():
|
||||
stack = _get_arg_stack()
|
||||
return stack[-1]
|
||||
|
||||
@ -144,7 +145,7 @@ def arg_scope(list_ops_or_scope, **kwargs):
|
||||
raise TypeError('list_ops_or_scope must either be a list/tuple or reused'
|
||||
'scope (i.e. dict)')
|
||||
try:
|
||||
current_scope = _current_arg_scope().copy()
|
||||
current_scope = current_arg_scope().copy()
|
||||
for op in list_ops_or_scope:
|
||||
key_op = _key_op(op)
|
||||
if not has_arg_scope(op):
|
||||
@ -172,7 +173,7 @@ def add_arg_scope(func):
|
||||
A tuple with the decorated function func_with_args().
|
||||
"""
|
||||
def func_with_args(*args, **kwargs):
|
||||
current_scope = _current_arg_scope()
|
||||
current_scope = current_arg_scope()
|
||||
current_args = kwargs
|
||||
key_func = _key_op(func)
|
||||
if key_func in current_scope:
|
||||
|
Loading…
x
Reference in New Issue
Block a user