提交 5a31a368 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Fix test with all/any, re-enable it

上级 31e48192
......@@ -315,9 +315,10 @@ class test_CAReduce(unittest_tools.InferShapeTester):
else:
self.fail()
else:
#numpy.{all,any} return bool type.
# numpy.{all,any} return bool type,
# but theano ops return an int8 array instead
if scalar_op in [scalar.and_, scalar.or_]:
zv = numpy.asarray(zv, dtype=dtype)
zv = numpy.asarray(zv, dtype='int8')
if test_nan:
self.assertTrue(theano.tensor.TensorType.values_eq(f(xv),
zv),
......@@ -357,10 +358,6 @@ class test_CAReduce(unittest_tools.InferShapeTester):
self.with_linker(gof.PerformLinker(), scalar.and_, dtype=dtype)
self.with_linker(gof.PerformLinker(), scalar.xor, dtype=dtype)
@dec.knownfailureif(
True,
("When there is nan in the input of CAReduce,"
" we don't have a good output. "))
def test_perform_nan(self):
for dtype in ["floatX", "complex64", "complex128"]:
self.with_linker(gof.PerformLinker(), scalar.add, dtype=dtype,
......@@ -372,12 +369,8 @@ class test_CAReduce(unittest_tools.InferShapeTester):
self.with_linker(gof.PerformLinker(), scalar.minimum, dtype=dtype,
test_nan=True)
self.with_linker(gof.PerformLinker(), scalar.or_, dtype=dtype,
test_nan=True)
self.with_linker(gof.PerformLinker(), scalar.and_, dtype=dtype,
test_nan=True)
self.with_linker(gof.PerformLinker(), or_, dtype=dtype,
test_nan=True, tensor_op=tensor.any)
self.with_linker(gof.PerformLinker(), and_, dtype=dtype,
self.with_linker(gof.PerformLinker(), scalar.and_, dtype=dtype,
test_nan=True, tensor_op=tensor.all)
def test_c(self):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论