Example #1
0
 def test_gpu_cholesky_inplace_opt(self):
     A = theano.tensor.fmatrix("A")
     fn = theano.function([A], GpuMagmaCholesky()(A), mode=mode_with_gpu)
     assert any([
         node.op.inplace for node in fn.maker.fgraph.toposort()
         if isinstance(node.op, GpuMagmaCholesky)
     ])
Example #2
0
 def run_gpu_cholesky(self, A_val, lower=True):
     A = theano.tensor.fmatrix("A")
     f = theano.function(
         [A],
         GpuMagmaCholesky(lower=lower)(A),
         mode=mode_with_gpu.excluding("cusolver"),
     )
     return f(A_val)
Example #3
0
 def test_gpu_cholesky_inplace(self):
     A = self.rand_symmetric(1000)
     A_gpu = gpuarray_shared_constructor(A)
     A_copy = A_gpu.get_value()
     fn = theano.function([],
                          GpuMagmaCholesky(inplace=True)(A_gpu),
                          mode=mode_with_gpu,
                          accept_inplace=True)
     fn()
     L = A_gpu.get_value()
     utt.assert_allclose(np.dot(L, L.T), A_copy, atol=1e-3)
Example #4
0
 def test_gpu_cholesky_inplace(self):
     A = self.rand_symmetric(1000)
     A_gpu = gpuarray_shared_constructor(A)
     A_copy = A_gpu.get_value()
     C = GpuMagmaCholesky()(A_gpu)
     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()
     L = A_gpu.get_value()
     utt.assert_allclose(np.dot(L, L.T), A_copy, atol=1e-3)