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