@contextlib.contextmanager
def no_backprop_mode():
 default = getattr(_thread_local, 'default_backprop', True)
 _thread_local.default_backprop = False
 (yield)
 _thread_local.default_backprop = default

@ contextlib . contextmanager def no_backprop_mode ( ) : default = getattr ( _thread_local , 'default_backprop' , True ) _thread_local . default_backprop = False ( yield ) _thread_local . default_backprop = default
disable back-propagation for variable whose volatile is auto .