@contextlib.contextmanager
def arg_scope(list_ops_or_scope, **kwargs):
 if isinstance(list_ops_or_scope, dict):
  if kwargs:
   raise ValueError('When attempting to re-use a scope by suppling adictionary, kwargs must be empty.')
  current_scope = list_ops_or_scope.copy()
  try:
   _get_arg_stack().append(current_scope)
   (yield current_scope)
  finally:
   _get_arg_stack().pop()
 else:
  if (not isinstance(list_ops_or_scope, (list, tuple))):
   raise TypeError('list_ops_or_scope must either be a list/tuple or reusedscope (i.e. dict)')
  try:
   current_scope = _current_arg_scope().copy()
   for op in list_ops_or_scope:
    key_op = (op.__module__, op.__name__)
    if (not has_arg_scope(op)):
     raise ValueError('%s is not decorated with @add_arg_scope', key_op)
    if (key_op in current_scope):
     current_kwargs = current_scope[key_op].copy()
     current_kwargs.update(kwargs)
     current_scope[key_op] = current_kwargs
    else:
     current_scope[key_op] = kwargs.copy()
   _get_arg_stack().append(current_scope)
   (yield current_scope)
  finally:
   _get_arg_stack().pop()

@ contextlib . contextmanager def arg_scope ( list_ops_or_scope , ** kwargs ) : if isinstance ( list_ops_or_scope , dict ) : if kwargs : raise ValueError ( 'When attempting to re-use a scope by suppling adictionary, kwargs must be empty.' ) current_scope = list_ops_or_scope . copy ( ) try : _get_arg_stack ( ) . append ( current_scope ) ( yield current_scope ) finally : _get_arg_stack ( ) . pop ( ) else : if ( not isinstance ( list_ops_or_scope , ( list , tuple ) ) ) : raise TypeError ( 'list_ops_or_scope must either be a list/tuple or reusedscope (i.e. dict)' ) try : current_scope = _current_arg_scope ( ) . copy ( ) for op in list_ops_or_scope : key_op = ( op . __module__ , op . __name__ ) if ( not has_arg_scope ( op ) ) : raise ValueError ( '%s is not decorated with @add_arg_scope' , key_op ) if ( key_op in current_scope ) : current_kwargs = current_scope [ key_op ] . copy ( ) current_kwargs . update ( kwargs ) current_scope [ key_op ] = current_kwargs else : current_scope [ key_op ] = kwargs . copy ( ) _get_arg_stack ( ) . append ( current_scope ) ( yield current_scope ) finally : _get_arg_stack ( ) . pop ( )
stores the default arguments for the given set of list_ops .