提交 bc23b8cc authored 作者: Brandon T. Willard's avatar Brandon T. Willard

Refactor TestMean so that it actually contains asserts

上级 c14fe346
...@@ -5441,9 +5441,9 @@ class TestDivimpl: ...@@ -5441,9 +5441,9 @@ class TestDivimpl:
class TestMean: class TestMean:
def test_regression_mean_of_ndarray_failure(self): def test_mean_single_element(self):
# This shouldn't throw an `AttributeError` (or any other, for that matter) res = tensor.mean(np.zeros(1))
tensor.mean(np.zeros(1)) assert res.eval() == 0.0
def test_mean_f16(self): def test_mean_f16(self):
x = tensor.vector(dtype="float16") x = tensor.vector(dtype="float16")
...@@ -5452,7 +5452,6 @@ class TestMean: ...@@ -5452,7 +5452,6 @@ class TestMean:
utt.assert_allclose(f(np.ones((100000,), dtype="float16")), 1.0) utt.assert_allclose(f(np.ones((100000,), dtype="float16")), 1.0)
def test_basic(self): def test_basic(self):
# Simple test...
x = tensor.vector() x = tensor.vector()
f = theano.function([x], tensor.mean(x)) f = theano.function([x], tensor.mean(x))
data = rand(50) data = rand(50)
...@@ -5460,7 +5459,7 @@ class TestMean: ...@@ -5460,7 +5459,7 @@ class TestMean:
def test_list(self): def test_list(self):
ll = [theano.shared(0.0), theano.shared(2.0)] ll = [theano.shared(0.0), theano.shared(2.0)]
tensor.mean(ll).eval() == 1 assert tensor.mean(ll).eval() == 1
class TestMatinv: class TestMatinv:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论