提交 71937484 authored 作者: Seton Steven Bocco's avatar Seton Steven Bocco

Fix magma-related inplace tests that fail in DEBUG_MODE:…

Fix magma-related inplace tests that fail in DEBUG_MODE: http://earlgrey.iro.umontreal.ca:8080/job/Theano_buildbot/45/testReport/
上级 b7b5dd39
...@@ -248,8 +248,13 @@ class TestMagma(unittest.TestCase): ...@@ -248,8 +248,13 @@ class TestMagma(unittest.TestCase):
test_rng = np.random.RandomState(seed=1) test_rng = np.random.RandomState(seed=1)
A_val_gpu = gpuarray_shared_constructor(test_rng.rand(N, N).astype('float32') * 2 - 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), A_val_gpu_inv = GpuMagmaMatrixInverse()(A_val_gpu)
mode=mode_with_gpu, accept_inplace=True) fn = theano.function([], A_val_gpu_inv, mode=mode_with_gpu, updates=[(A_val_gpu, A_val_gpu_inv)])
assert any([
node.op.inplace
for node in fn.maker.fgraph.toposort() if
isinstance(node.op, GpuMagmaMatrixInverse)
])
fn() fn()
utt.assert_allclose(np.eye(N), np.dot(A_val_gpu.get_value(), A_val_copy), atol=5e-3) utt.assert_allclose(np.eye(N), np.dot(A_val_gpu.get_value(), A_val_copy), atol=5e-3)
...@@ -359,8 +364,13 @@ class TestMagma(unittest.TestCase): ...@@ -359,8 +364,13 @@ class TestMagma(unittest.TestCase):
A = self.rand_symmetric(1000) A = self.rand_symmetric(1000)
A_gpu = gpuarray_shared_constructor(A) A_gpu = gpuarray_shared_constructor(A)
A_copy = A_gpu.get_value() A_copy = A_gpu.get_value()
fn = theano.function([], GpuMagmaCholesky(inplace=True)(A_gpu), C = GpuMagmaCholesky()(A_gpu)
mode=mode_with_gpu, accept_inplace=True) fn = theano.function([], C, mode=mode_with_gpu, updates=[(A_gpu, C)])
assert any([
node.op.inplace
for node in fn.maker.fgraph.toposort() if
isinstance(node.op, GpuMagmaCholesky)
])
fn() fn()
L = A_gpu.get_value() L = A_gpu.get_value()
utt.assert_allclose(np.dot(L, L.T), A_copy, atol=1e-3) utt.assert_allclose(np.dot(L, L.T), A_copy, atol=1e-3)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论