提交 ce197453 authored 作者: Tanjay94's avatar Tanjay94

Fixed norm tests to fusion 5 tuple into 1 list.

上级 18731a6a
...@@ -39,7 +39,6 @@ from theano.sandbox.linalg.ops import (cholesky, ...@@ -39,7 +39,6 @@ from theano.sandbox.linalg.ops import (cholesky,
from theano.sandbox.linalg import eig, eigh, eigvalsh from theano.sandbox.linalg import eig, eigh, eigvalsh
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from nose.plugins.skip import SkipTest
def check_lower_triangular(pd, ch_f): def check_lower_triangular(pd, ch_f):
ch = ch_f(pd) ch = ch_f(pd)
...@@ -674,16 +673,16 @@ class T_NormTests(unittest.TestCase): ...@@ -674,16 +673,16 @@ class T_NormTests(unittest.TestCase):
b = rng.rand(4).astype(theano.config.floatX) b = rng.rand(4).astype(theano.config.floatX)
c = rng.rand(4, 4, 4).astype(theano.config.floatX) c = rng.rand(4, 4, 4).astype(theano.config.floatX)
A = [None, 'fro', 'inf', '-inf', 1, -1, None, 'inf', '-inf', 0, 1, -1, 2, -2, None, 'fro', 'inf', '-inf', 1, -1, None, 'inf', '-inf', 0, 1, -1, 2, -2] A = ( [None, 'fro', 'inf', '-inf', 1, -1, None, 'inf', '-inf', 0, 1, -1, 2, -2, None, 'fro', 'inf', '-inf', 1, -1, None, 'inf', '-inf', 0, 1, -1, 2, -2],
B = [M, M, M, M, M, M, V, V, V, V, V, V, V, V, N, N, N, N, N, N, N, N, N, N, N, N, N, N] [M, M, M, M, M, M, V, V, V, V, V, V, V, V, N, N, N, N, N, N, N, N, N, N, N, N, N, N],
C = [None, None, None, None, None, None, None, None, None, None, None, None, None, None, [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], 0, 0, 0, 0, 0, 0, 0, 0] [None, None, None, None, None, None, None, None, None, None, None, None, None, None, [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], 0, 0, 0, 0, 0, 0, 0, 0],
D = [a, a, a, a, a, a, b, b, b, b, b, b, b, b, c, c, c, c, c, c, c, c, c, c, c, c, c, c] [a, a, a, a, a, a, b, b, b, b, b, b, b, b, c, c, c, c, c, c, c, c, c, c, c, c, c, c],
E = [None, 'fro', inf, -inf, 1, -1, None, inf, -inf, 0, 1, -1, 2, -2, None, 'fro', inf, -inf, 1, -1, None, inf, -inf, 0, 1, -1, 2, -2] [None, 'fro', inf, -inf, 1, -1, None, inf, -inf, 0, 1, -1, 2, -2, None, 'fro', inf, -inf, 1, -1, None, inf, -inf, 0, 1, -1, 2, -2])
for i in range(0, 28): for i in range(0, 28):
f.append(function([B[i]], [norm(B[i], A[i], C[i])])) f.append(function([A[1][i]], [norm(A[1][i], A[0][i], A[2][i])]))
t_n.append(f[i](D[i])) t_n.append(f[i](A[3][i]))
n_n.append(numpy.linalg.norm(D[i], E[i], C[i])) n_n.append(numpy.linalg.norm(A[3][i], A[4][i], A[2][i]))
assert _allclose(n_n[i], t_n[i]) assert _allclose(n_n[i], t_n[i])
except TypeError: except TypeError:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论