提交 30c3ed89 authored 作者: Iulian Vlad Serban's avatar Iulian Vlad Serban

Update on merged work for #4659

上级 95fba1b6
...@@ -53,7 +53,7 @@ class MissingInputError(Exception): ...@@ -53,7 +53,7 @@ class MissingInputError(Exception):
# The call to list is needed for Python 3 # The call to list is needed for Python 3
assert list(kwargs.keys()) == ["variable"] assert list(kwargs.keys()) == ["variable"]
tr = getattr(list(kwargs.values())[0].tag, 'trace', []) tr = getattr(list(kwargs.values())[0].tag, 'trace', [])
if type(tr) is list and len(tr) > 0: if isinstance(tr, list) is list and len(tr) > 0:
sio = StringIO() sio = StringIO()
print("\nBacktrace when the variable is created:", file=sio) print("\nBacktrace when the variable is created:", file=sio)
for subtr in list(kwargs.values())[0].tag.trace: for subtr in list(kwargs.values())[0].tag.trace:
......
...@@ -179,7 +179,7 @@ def raise_with_op(node, thunk=None, exc_info=None, storage_map=None): ...@@ -179,7 +179,7 @@ def raise_with_op(node, thunk=None, exc_info=None, storage_map=None):
# Print node backtraces # Print node backtraces
tr = getattr(node.outputs[0].tag, 'trace', []) tr = getattr(node.outputs[0].tag, 'trace', [])
if type(tr) is list and len(tr) > 0: if isinstance(tr, list) is list and len(tr) > 0:
detailed_err_msg += "\nBacktrace when the node is created(use Theano flag traceback.limit=N to make it longer):\n" detailed_err_msg += "\nBacktrace when the node is created(use Theano flag traceback.limit=N to make it longer):\n"
# Print separate message for each element in the list of batcktraces # Print separate message for each element in the list of batcktraces
......
...@@ -3010,9 +3010,17 @@ def check_stack_trace(f_or_fgraph, ops_to_check='last', bug_print='raise'): ...@@ -3010,9 +3010,17 @@ def check_stack_trace(f_or_fgraph, ops_to_check='last', bug_print='raise'):
else: else:
raise ValueError('The string bug_print is not recognised') raise ValueError('The string bug_print is not recognised')
print("apply_nodes_to_check")
print(apply_nodes_to_check)
for node in apply_nodes_to_check: for node in apply_nodes_to_check:
for output in node.outputs: for output in node.outputs:
print('Checking node')
print (node)
if (not hasattr(output.tag, 'trace') or not output.tag.trace): if (not hasattr(output.tag, 'trace') or not output.tag.trace):
print ('Failed on node')
print (node)
#print(node.outputs[0].tag.trace)
#print(node.tag.trace)
return False return False
return True return True
...@@ -4226,7 +4226,7 @@ def local_flatten_lift(node): ...@@ -4226,7 +4226,7 @@ def local_flatten_lift(node):
# Copy over stacktrace from previous output node and from unary # Copy over stacktrace from previous output node and from unary
# elementwise output node since if there was an error, it would # elementwise output node since if there was an error, it would
# probably have come from that operation. # probably have come from that operation.
copy_stack_trace(node.outputs + node.inputs[0], e) copy_stack_trace(node.outputs + node.inputs, e)
return [e] return [e]
...@@ -5186,7 +5186,7 @@ def local_sum_prod_mul_by_scalar(node): ...@@ -5186,7 +5186,7 @@ def local_sum_prod_mul_by_scalar(node):
ret = T.mul(*mul_inputs) ret = T.mul(*mul_inputs)
# Copy over stacktrace from previous output to new mul op, # Copy over stacktrace from previous output to new mul op,
# for same reason as above. # for same reason as above.
copy_stack_trace(node.outputs, ret+mul_inputs) copy_stack_trace(node.outputs, [ret]+mul_inputs)
return [ret] return [ret]
...@@ -5196,7 +5196,7 @@ def local_sum_prod_mul_by_scalar(node): ...@@ -5196,7 +5196,7 @@ def local_sum_prod_mul_by_scalar(node):
# There are never errors in the negative op, thus # There are never errors in the negative op, thus
# we need only to copy over stacktrace from previous output node to # we need only to copy over stacktrace from previous output node to
# the two new ops. # the two new ops.
copy_stack_trace(node.outputs, s+ret) copy_stack_trace(node.outputs, [s, ret])
return [ret] return [ret]
...@@ -5212,8 +5212,8 @@ def local_elemwise_sub_zeros(node): ...@@ -5212,8 +5212,8 @@ def local_elemwise_sub_zeros(node):
node.op.scalar_op == scalar.sub and node.op.scalar_op == scalar.sub and
node.inputs[0] == node.inputs[1]): node.inputs[0] == node.inputs[1]):
res = T.zeros_like(node.inputs[0]) res = T.zeros_like(node.inputs[0])
# Copy over stacktrace from previous output. # Copy over stacktrace from previous output.
# Julian: Pascal, is this really necessary? Is there anyway zeros_like can ever fail?
copy_stack_trace(node.outputs, res) copy_stack_trace(node.outputs, res)
return [res] return [res]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论