提交 8af088f7 authored 作者: Frederic's avatar Frederic

remove duplicate test case and simplify test.

上级 f9d3e701
...@@ -80,21 +80,13 @@ class TestKeepDims(unittest.TestCase): ...@@ -80,21 +80,13 @@ class TestKeepDims(unittest.TestCase):
assert numpy.allclose(ans1, ans2) assert numpy.allclose(ans1, ans2)
assert ans1.shape == ans2.shape assert ans1.shape == ans2.shape
keep_param = function([x], op(x, axis=None, keepdims=True))
keep_synth = function([x], self.makeKeepDims_local(x,
op(x, axis=None, keepdims=False), None))
ans1 = keep_param(a)
ans2 = keep_synth(a)
assert numpy.allclose(ans1, ans2)
assert ans1.shape == ans2.shape
# the following ops can be specified with a freely specified axis # the following ops can be specified with a freely specified axis
# parameter # parameter
for op in ([tensor.sum, tensor.prod, tensor.mean, tensor.var, for op in ([tensor.sum, tensor.prod, tensor.mean, tensor.var,
tensor.std, tensor.all, tensor.any, tensor.std, tensor.all, tensor.any,
tensor.max, tensor.min]): tensor.max, tensor.min]):
for axis in [0, 1, 2, [0], [1], [2], [0, 1], [1, 2], [0, 1, 2], for axis in [0, 1, 2, [0], [1], [2], None,
[0, 1], [1, 2], [0, 1, 2],
[-1], [-2], [-3], [-1, -2], [-1, -2, -3], [0, -2, 2]]: [-1], [-2], [-3], [-1, -2], [-1, -2, -3], [0, -2, 2]]:
keep_param = function([x], op(x, axis=axis, keepdims=True)) keep_param = function([x], op(x, axis=axis, keepdims=True))
...@@ -105,12 +97,3 @@ class TestKeepDims(unittest.TestCase): ...@@ -105,12 +97,3 @@ class TestKeepDims(unittest.TestCase):
ans2 = keep_synth(a) ans2 = keep_synth(a)
assert numpy.allclose(ans1, ans2) assert numpy.allclose(ans1, ans2)
assert ans1.shape == ans2.shape assert ans1.shape == ans2.shape
keep_param = function([x], op(x, axis=None, keepdims=True))
keep_synth = function([x], self.makeKeepDims_local(x,
op(x, axis=None, keepdims=False), None))
ans1 = keep_param(a)
ans2 = keep_synth(a)
assert numpy.allclose(ans1, ans2)
assert ans1.shape == ans2.shape
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论