提交 8954275d authored 作者: Frederic's avatar Frederic

More information in error message

上级 dbc61422
...@@ -110,13 +110,17 @@ def raise_with_op(node, thunk=None, exc_info=None, storage_map=None): ...@@ -110,13 +110,17 @@ def raise_with_op(node, thunk=None, exc_info=None, storage_map=None):
trace = () trace = ()
exc_value.__thunk_trace__ = trace exc_value.__thunk_trace__ = trace
exc_value.__op_instance__ = node exc_value.__op_instance__ = node
if node in node.fgraph.toposort(): topo = node.fgraph.toposort()
exc_value.__applynode_index__ = node.fgraph.toposort().index(node) if node in topo:
node_index = topo.index(node)
else: else:
exc_value.__applynode_index__ = None node_index = None
exc_value.__applynode_index__ = node_index
hints = [] hints = []
detailed_err_msg = "\nApply node that caused the error: " + str(node) detailed_err_msg = "\nApply node that caused the error: " + str(node)
if exc_value.__applynode_index__ is not None:
detailed_err_msg += "\nToposort index: %d" % node_index
types = [getattr(ipt, 'type', 'No type') for ipt in node.inputs] types = [getattr(ipt, 'type', 'No type') for ipt in node.inputs]
detailed_err_msg += "\nInputs types: %s\n" % types detailed_err_msg += "\nInputs types: %s\n" % types
...@@ -137,10 +141,11 @@ def raise_with_op(node, thunk=None, exc_info=None, storage_map=None): ...@@ -137,10 +141,11 @@ def raise_with_op(node, thunk=None, exc_info=None, storage_map=None):
shapes = "The thunk don't have an inputs attributes." shapes = "The thunk don't have an inputs attributes."
strides = "So we can't access the strides of inputs values" strides = "So we can't access the strides of inputs values"
scalar_values = "And can't print its inputs scalar value" scalar_values = "And can't print its inputs scalar value"
clients = [[c[0] for c in var.clients] for var in node.outputs]
detailed_err_msg += ("Inputs shapes: %s" % shapes + detailed_err_msg += ("Inputs shapes: %s" % shapes +
"\nInputs strides: %s" % strides + "\nInputs strides: %s" % strides +
"\nInputs values: %s\n" % scalar_values) "\nInputs values: %s" % scalar_values +
"\nOutputs clients: %s\n" % clients)
else: else:
hints.append( hints.append(
"HINT: Use another linker then the c linker to" "HINT: Use another linker then the c linker to"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论