提交 b65be6c3 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Add test for zero-shape array.

This one would have failed in DebugMode and FAST_COMPILE before the fix.
上级 2866d21b
......@@ -3083,6 +3083,15 @@ class T_max_and_argmax(unittest.TestCase):
v = eval_outputs(max_and_argmax(x, [1, -1])[0].shape)
assert tuple(v) == numpy.max(data, (1, -1)).shape
def test_zero_shape(self):
x = tensor.matrix()
m, i = max_and_argmax(x, axis=1)
f = theano.function([x], [m, i])
xv = numpy.zeros((0, 4), dtype=floatX)
mv, iv = f(xv)
assert mv.shape == (0,)
assert iv.shape == (0,)
class T_argmin_argmax(unittest.TestCase):
def setUp(self):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论