提交 307ab3e4 authored 作者: Frederic's avatar Frederic

In NanGuardMode, do not check the inputs of node that are already checked

上级 038fb754
...@@ -305,14 +305,16 @@ class NanGuardMode(Mode): ...@@ -305,14 +305,16 @@ class NanGuardMode(Mode):
""" """
inputs = fn.inputs inputs = fn.inputs
# TODO: figure out why individual inputs are themselves lists for x, var in zip(inputs, node.inputs):
# sometimes # If the input is the result of computation, then we
for x in flatten(inputs): # don't need to check it. It is already done after the
do_check_on(x, node, fn, True) # computation.
if not var.owner:
do_check_on(x[0], node, fn, True)
fn() fn()
outputs = fn.outputs outputs = fn.outputs
for j, x in enumerate(flatten(outputs)): for x in outputs:
do_check_on(x, node, fn, False) do_check_on(x[0], node, fn, False)
wrap_linker = theano.gof.WrapLinker([theano.gof.OpWiseCLinker()], wrap_linker = theano.gof.WrapLinker([theano.gof.OpWiseCLinker()],
nan_check) nan_check)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论