提交 9df815dc authored 作者: abergeron's avatar abergeron

Merge pull request #1716 from nouiz/err_msg

When an apply node execution raise an error, print the inputs values when they are scalars.
...@@ -120,15 +120,23 @@ def raise_with_op(op, thunk=None, exc_info=None): ...@@ -120,15 +120,23 @@ def raise_with_op(op, thunk=None, exc_info=None):
for ipt in thunk.inputs] for ipt in thunk.inputs]
strides = [getattr(ipt[0], 'strides', 'No strides') strides = [getattr(ipt[0], 'strides', 'No strides')
for ipt in thunk.inputs] for ipt in thunk.inputs]
scalar_values = []
for ipt in thunk.inputs:
if getattr(ipt[0], "size", -1) == 1:
scalar_values.append(ipt[0])
else:
scalar_values.append("not scalar")
else: else:
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 storage inputs value" strides = "So we can't access the strides of inputs values"
scalar_values = "And can't print its inputs scalar value"
types = [getattr(ipt, 'type', 'No type') types = [getattr(ipt, 'type', 'No type')
for ipt in op.inputs] for ipt in op.inputs]
detailed_err_msg += ("\nInputs shapes: %s" % shapes + detailed_err_msg += ("\nInputs shapes: %s" % shapes +
"\nInputs strides: %s" % strides + "\nInputs strides: %s" % strides +
"\nInputs types: %s" % types) "\nInputs types: %s" % types +
"\nInputs scalar values: %s" % scalar_values)
else: else:
detailed_err_msg += ("\nUse another linker then the c linker to" detailed_err_msg += ("\nUse another linker then the c linker to"
" have the inputs shapes and strides printed.") " have the inputs shapes and strides printed.")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论