提交 fa016770 authored 作者: Frederic Bastien's avatar Frederic Bastien

Fix test CAReduce of add with bool.

上级 d85528d4
...@@ -426,6 +426,9 @@ class test_CAReduce(unittest_tools.InferShapeTester): ...@@ -426,6 +426,9 @@ class test_CAReduce(unittest_tools.InferShapeTester):
elif scalar_op == scalar.add: elif scalar_op == scalar.add:
for axis in reversed(sorted(tosum)): for axis in reversed(sorted(tosum)):
zv = numpy.add.reduce(zv, axis) zv = numpy.add.reduce(zv, axis)
if dtype == 'bool':
# numpy.add of a bool upcast, while CAReduce don't
zv = zv.astype(dtype)
elif scalar_op == scalar.mul: elif scalar_op == scalar.mul:
for axis in reversed(sorted(tosum)): for axis in reversed(sorted(tosum)):
zv = numpy.multiply.reduce(zv, axis) zv = numpy.multiply.reduce(zv, axis)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论