提交 61f4f3b7 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Include dtypes in error message.

Since dtype mismatch is one reason the error is raised, it makes interpreting it easier.
上级 0186901e
...@@ -243,16 +243,19 @@ def makeTester(name, op, expected, checks={}, good={}, bad_build={}, ...@@ -243,16 +243,19 @@ def makeTester(name, op, expected, checks={}, good={}, bad_build={},
or variable.shape != expected.shape or variable.shape != expected.shape
or numpy.any(abs(variable - expected) > eps)): or numpy.any(abs(variable - expected) > eps)):
self.fail(("Test %s::%s: Output %s gave the wrong" self.fail(("Test %s::%s: Output %s gave the wrong"
" value. With inputs %s, expected %s, got %s." " value. With inputs %s, expected %s (dtype %s),"
" numpy.allclose return %s %s") % ( " got %s (dtype %s)."
" numpy.allclose returns %s %s") % (
self.op, self.op,
testname, testname,
i, i,
inputs, inputs,
expected, expected,
variable, expected.dtype,
numpy.allclose(variable, expected, atol=eps), variable,
numpy.allclose(variable, expected))) variable.dtype,
numpy.allclose(variable, expected, atol=eps),
numpy.allclose(variable, expected)))
for description, check in self.checks.items(): for description, check in self.checks.items():
if not check(inputs, variables): if not check(inputs, variables):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论