提交 1cda3cfc authored 作者: yobibyte's avatar yobibyte

Fix rebase. Make flake8 silent.

上级 f1f333d0
......@@ -794,6 +794,7 @@ def tensorinv(a, ind=2):
"""
return TensorInv(ind)(a)
class TensorSolve(Op):
"""
Theano utilization of numpy.linalg.tensorsolve
......@@ -848,5 +849,6 @@ def tensorsolve(a, b, axes=None):
------
LinAlgError
If `a` is singular or not 'square' (in the above sense).
"""
return TensorSolve(axes)(a, b)
......@@ -39,7 +39,7 @@ from theano.tensor.nlinalg import ( MatrixInverse,
norm,
svd,
TensorInv,
tensorinv
tensorinv,
tensorsolve
)
from nose.plugins.attrib import attr
......@@ -172,9 +172,9 @@ def test_tensorsolve():
fn = function([A, B], [X])
# slightly modified example from numpy.linalg.tensorsolve docstring
a = numpy.eye(2*3*4).astype(theano.config.floatX)
a.shape = (2*3, 4, 2, 3*4)
b = rng.rand(2*3, 4).astype(theano.config.floatX)
a = numpy.eye(2 * 3 * 4).astype(theano.config.floatX)
a.shape = (2 * 3, 4, 2, 3 * 4)
b = rng.rand(2 * 3, 4).astype(theano.config.floatX)
n_x = numpy.linalg.tensorsolve(a, b)
t_x = fn(a, b)
......@@ -186,9 +186,9 @@ def test_tensorsolve():
Y = tensorsolve(C, D)
fn = function([C, D], [Y])
c = numpy.eye(2*3*4).astype('float32')
c.shape = (2*3, 4, 2, 3*4)
d = rng.rand(2*3, 4).astype('float64')
c = numpy.eye(2 * 3 * 4, dtype='float32')
c.shape = (2 * 3, 4, 2, 3 * 4)
d = rng.rand(2 * 3, 4).astype('float64')
n_y = numpy.linalg.tensorsolve(c, d)
t_y = fn(c, d)
assert _allclose(n_y, t_y)
......@@ -200,9 +200,9 @@ def test_tensorsolve():
Z = tensorsolve(E, F)
fn = function([E, F], [Z])
e = numpy.eye(2*3*4).astype('int32')
e.shape = (2*3, 4, 2, 3*4)
f = rng.rand(2*3, 4).astype('float64')
e = numpy.eye(2 * 3 * 4, dtype='int32')
e.shape = (2 * 3, 4, 2, 3 * 4)
f = rng.rand(2 * 3, 4).astype('float64')
n_z = numpy.linalg.tensorsolve(e, f)
t_z = fn(e, f)
assert _allclose(n_z, t_z)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论