提交 161787ed authored 作者: Frederic Bastien's avatar Frederic Bastien

code clean up

上级 948f7266
...@@ -341,7 +341,7 @@ class FunctionGraph(utils.object2): ...@@ -341,7 +341,7 @@ class FunctionGraph(utils.object2):
sio = StringIO() sio = StringIO()
for subtr in tr: for subtr in tr:
traceback.print_list(subtr, sio) traceback.print_list(subtr, sio)
detailed_err_msg += str(sio.getvalue()) detailed_err_msg += str(sio.getvalue())
raise MissingInputError( raise MissingInputError(
'A variable that is an input to the graph was ' 'A variable that is an input to the graph was '
'neither provided as an input to the function ' 'neither provided as an input to the function '
......
...@@ -165,7 +165,7 @@ def raise_with_op(node, thunk=None, exc_info=None, storage_map=None): ...@@ -165,7 +165,7 @@ def raise_with_op(node, thunk=None, exc_info=None, storage_map=None):
sio = StringIO() sio = StringIO()
for subtr in tr: for subtr in tr:
traceback.print_list(subtr, sio) traceback.print_list(subtr, sio)
detailed_err_msg += str(sio.getvalue()) detailed_err_msg += str(sio.getvalue())
else: else:
hints.append( hints.append(
"HINT: Re-running with most Theano optimization disabled could" "HINT: Re-running with most Theano optimization disabled could"
......
...@@ -465,7 +465,7 @@ class PureOp(object): ...@@ -465,7 +465,7 @@ class PureOp(object):
sio = StringIO() sio = StringIO()
for subtr in tr: for subtr in tr:
traceback.print_list(subtr, sio) traceback.print_list(subtr, sio)
detailed_err_msg += str(sio.getvalue()) detailed_err_msg += str(sio.getvalue())
detailed_err_msg += ( detailed_err_msg += (
"\nThe error when converting the test value to that" "\nThe error when converting the test value to that"
......
...@@ -85,7 +85,7 @@ def copy_stack_trace(from_var, to_var): ...@@ -85,7 +85,7 @@ def copy_stack_trace(from_var, to_var):
# If from_var is a list, store concatenated stack traces # If from_var is a list, store concatenated stack traces
if len(from_var) > 0: if len(from_var) > 0:
for v in from_var: for v in from_var:
if hasattr(v.tag, 'trace') and len(v.tag.trace) > 0: if hasattr(v.tag, 'trace'):
tr = tr + v.tag.trace tr = tr + v.tag.trace
else: else:
# If from_var is not a list, it must be a single tensor # If from_var is not a list, it must be a single tensor
...@@ -98,17 +98,11 @@ def copy_stack_trace(from_var, to_var): ...@@ -98,17 +98,11 @@ def copy_stack_trace(from_var, to_var):
# Copy over stack traces from from_var to each variable in # Copy over stack traces from from_var to each variable in
# to_var, including the stack_trace of the to_var before # to_var, including the stack_trace of the to_var before
for v in to_var: for v in to_var:
if hasattr(v.tag, 'trace'): v.tag.trace = getattr(v.tag, 'trace', []) + tr
v.tag.trace = v.tag.trace + tr
else:
v.tag.trace = tr
else: else:
# Copy over stack traces from from_var to each variable to # Copy over stack traces from from_var to each variable to
# to_var, including the stack_trace of the to_var before # to_var, including the stack_trace of the to_var before
if hasattr(to_var.tag, 'trace'): to_var.tag.trace = getattr(to_var.tag, 'trace', []) + tr
to_var.tag.trace = to_var.tag.trace + tr
else:
to_var.tag.trace = tr
def out2in(*local_opts, **kwargs): def out2in(*local_opts, **kwargs):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论