提交 54713094 authored 作者: Reyhane Askari's avatar Reyhane Askari

removed check for output guard in debug mode when cycle_detection is fast

上级 dccc8e50
......@@ -2272,25 +2272,26 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions
"of", len(li), "events was stable.",
file=sys.stderr)
self.fgraph = fgraph
destroy_handler_added = False
for feature in fgraph._features:
if isinstance(feature, gof.DestroyHandler):
destroy_handler_added = True
break
if not destroy_handler_added:
fgraph.attach_feature(gof.DestroyHandler())
for o in fgraph.outputs:
try:
with change_flags(compute_test_value=config.compute_test_value_opt):
fgraph.replace_validate(o, _output_guard(o), reason='output_guard')
raise Exception("Output variable %s required output_guard, "
"how was this output left unprotected against "
"destructive operations?" % o)
except gof.InconsistencyError:
# This output is already impossible to destroy.
# No guard necessary
pass
if theano.config.cycle_detection == 'regular':
destroy_handler_added = False
for feature in fgraph._features:
if isinstance(feature, gof.DestroyHandler):
destroy_handler_added = True
break
if not destroy_handler_added:
fgraph.attach_feature(gof.DestroyHandler())
for o in fgraph.outputs:
try:
with change_flags(compute_test_value=config.compute_test_value_opt):
fgraph.replace_validate(o, _output_guard(o), reason='output_guard')
raise Exception("Output variable %s required output_guard, "
"how was this output left unprotected against "
"destructive operations?" % o)
except gof.InconsistencyError:
# This output is already impossible to destroy.
# No guard necessary
pass
linker = _Linker(self)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论