提交 4baf9c1d authored 作者: notoraptor's avatar notoraptor

Revert last changes and use a fixed seed.

上级 2ab14685
...@@ -212,13 +212,16 @@ class TestMagma(unittest.TestCase): ...@@ -212,13 +212,16 @@ class TestMagma(unittest.TestCase):
fn = theano.function([A], gpu_matrix_inverse(A), mode=mode_with_gpu) fn = theano.function([A], gpu_matrix_inverse(A), mode=mode_with_gpu)
N = 1000 N = 1000
A_val = rand(N, N).astype('float32') test_rng = np.random.RandomState(seed=1)
# Copied from theano.tensor.tests.test_basic.rand.
A_val = test_rng.rand(N, N).astype('float32') * 2 - 1
A_val_inv = fn(A_val) A_val_inv = fn(A_val)
utt.assert_allclose(np.eye(N), np.dot(A_val_inv, A_val), atol=5e-3) utt.assert_allclose(np.eye(N), np.dot(A_val_inv, A_val), atol=5e-3)
def test_gpu_matrix_inverse_inplace(self): def test_gpu_matrix_inverse_inplace(self):
N = 1000 N = 1000
A_val_gpu = gpuarray_shared_constructor(rand(N, N).astype('float32')) test_rng = np.random.RandomState(seed=1)
A_val_gpu = gpuarray_shared_constructor(test_rng.rand(N, N).astype('float32') * 2 - 1)
A_val_copy = A_val_gpu.get_value() A_val_copy = A_val_gpu.get_value()
fn = theano.function([], GpuMagmaMatrixInverse(inplace=True)(A_val_gpu), fn = theano.function([], GpuMagmaMatrixInverse(inplace=True)(A_val_gpu),
mode=mode_with_gpu, accept_inplace=True) mode=mode_with_gpu, accept_inplace=True)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论