提交 57756a29 authored 作者: Frederic Bastien's avatar Frederic Bastien

Have the error printed only once.

上级 36c2ee9b
......@@ -52,13 +52,9 @@ class MissingInputError(Exception):
if kwargs:
# The call to list is needed for Python 3
assert list(kwargs.keys()) == ["variable"]
tr = getattr(list(kwargs.values())[0].tag, 'trace', [])
if isinstance(tr, list) and len(tr) > 0:
sio = StringIO()
print("\nBacktrace when the variable is created:", file=sio)
for subtr in list(kwargs.values())[0].tag.trace:
traceback.print_list(subtr, sio)
args = args + (str(sio.getvalue()),)
error_msg = get_variable_trace_string(kwargs["variable"])
if error_msg:
args = args + (error_msg,)
s = '\n'.join(args) # Needed to have the new line print correctly
Exception.__init__(self, s)
......@@ -393,7 +389,6 @@ class FunctionGraph(utils.object2):
"Theano flag exception_verbosity='high', "
"for more information on this error."
% (node.inputs.index(r), str(node)))
error_msg += get_variable_trace_string(r)
raise MissingInputError(error_msg, variable=r)
for node in new_nodes:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论