提交 805991f1 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Merge pull request #3206 from julianser/new_stacktrace_fix

Continued work on #3018: Stacktrace fix
...@@ -199,7 +199,7 @@ optdb.register('merge1', gof.MergeOptimizer(), ...@@ -199,7 +199,7 @@ optdb.register('merge1', gof.MergeOptimizer(),
# rearranges elemwise expressions # rearranges elemwise expressions
optdb.register('canonicalize', gof.EquilibriumDB(ignore_newtrees=False), optdb.register('canonicalize', gof.EquilibriumDB(ignore_newtrees=False),
1, 'fast_run', 'fast_compile') 1, 'fast_run', 'fast_compile', 'canonicalize_db')
# Register in the canonizer Equilibrium as a clean up opt the merge opt. # Register in the canonizer Equilibrium as a clean up opt the merge opt.
# Without this, as the equilibrium have ignore_newtrees=False, we # Without this, as the equilibrium have ignore_newtrees=False, we
# won't merge all nodes if it is set as a global optimizer with # won't merge all nodes if it is set as a global optimizer with
......
...@@ -450,7 +450,7 @@ class FunctionGraph(utils.object2): ...@@ -450,7 +450,7 @@ class FunctionGraph(utils.object2):
assert path is not None assert path is not None
tr = getattr(r.tag, 'trace', []) tr = getattr(r.tag, 'trace', [])
detailed_err_msg = "" detailed_err_msg = ""
if len(tr) > 0: if type(tr) is list and len(tr) > 0:
detailed_err_msg += "\nBacktrace when the variable is created:\n" detailed_err_msg += "\nBacktrace when the variable is created:\n"
# Print separate message for each element in # Print separate message for each element in
......
...@@ -168,7 +168,7 @@ def raise_with_op(node, thunk=None, exc_info=None, storage_map=None): ...@@ -168,7 +168,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 len(tr) > 0: if type(tr) is list and len(tr) > 0:
detailed_err_msg += "\nBacktrace when the node is created:\n" detailed_err_msg += "\nBacktrace when the node is created:\n"
# Print separate message for each element in the list of batcktraces # Print separate message for each element in the list of batcktraces
......
...@@ -542,7 +542,7 @@ class PureOp(object): ...@@ -542,7 +542,7 @@ class PureOp(object):
"For compute_test_value, one input test value does not" "For compute_test_value, one input test value does not"
" have the requested type.\n") " have the requested type.\n")
tr = getattr(v.tag, 'trace', []) tr = getattr(v.tag, 'trace', [])
if len(tr) > 0: if type(tr) is list and len(tr) > 0:
detailed_err_msg += ( detailed_err_msg += (
" \nBacktrace when that variable is created:\n") " \nBacktrace when that variable is created:\n")
# Print separate message for each element in the list # Print separate message for each element in the list
......
...@@ -77,6 +77,7 @@ def add_tag_trace(thing, user_line=1): ...@@ -77,6 +77,7 @@ def add_tag_trace(thing, user_line=1):
if limit == -1: if limit == -1:
limit = None limit = None
tr = simple_extract_stack(limit=limit)[:-1] tr = simple_extract_stack(limit=limit)[:-1]
# Different python version use different sementic for # Different python version use different sementic for
# limit. python 2.7 include the call to extrack_stack. The -1 get # limit. python 2.7 include the call to extrack_stack. The -1 get
# rid of it. # rid of it.
...@@ -93,7 +94,11 @@ def add_tag_trace(thing, user_line=1): ...@@ -93,7 +94,11 @@ def add_tag_trace(thing, user_line=1):
"theano/sparse/", "theano\\sparse\\", "theano/sparse/", "theano\\sparse\\",
"theano/typed_list/", "theano\\typed_list\\", "theano/typed_list/", "theano\\typed_list\\",
]: ]:
if p in file_path: # Julian: I added the 'tests' exception together with Arnaud.
# Otherwise, we'd lose the stack trace during in our test cases
# (e.g. in test_opt.py). We're not sure this is the right way to
# do it though.
if p in file_path and 'tests' not in file_path:
tr = tr[:-1] tr = tr[:-1]
rm = True rm = True
break break
......
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论