提交 f4d83429 authored 作者: Frederic's avatar Frederic

Add more test.

上级 cbf387b7
......@@ -1804,6 +1804,7 @@ class T_min_max(unittest.TestCase):
assert v == (3)
def test3(self):
# Test with 1 axis or all axis out of 3 dims
data = numpy.random.rand(2, 3, 4)
n = as_tensor_variable(data)
for fct, nfct in [(max, numpy.max), (min, numpy.min)]:
......@@ -1815,6 +1816,18 @@ class T_min_max(unittest.TestCase):
v_shape = eval_outputs(fct(n, axis).shape)
assert tuple(v_shape) == nfct(data, np_axis).shape
def test3b(self):
# Test with 2 axis out of 3 dims
data = numpy.random.rand(2, 3, 4)
n = as_tensor_variable(data)
for fct, nfct in [(max, numpy.max), (min, numpy.min)]:
for axis in [[0, 1], [1, 2], [0, 2]]:
v = eval_outputs(fct(n, axis))
np_v = nfct(nfct(data, axis[1]), axis[0])
self.assertTrue(numpy.all(v == np_v))
v_shape = eval_outputs(fct(n, axis).shape)
assert tuple(v_shape) == np_v.shape
def test_grad_max(self):
data = numpy.random.rand(2, 3)
n = as_tensor_variable(data)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论