def run_gpu_svd(self, A_val, full_matrices=True, compute_uv=True): A = theano.tensor.fmatrix("A") f = theano.function( [A], gpu_svd(A, full_matrices=full_matrices, compute_uv=compute_uv), mode=mode_with_gpu, ) return f(A_val)
def test_gpu_singular_values(self): A = theano.tensor.fmatrix("A") f_cpu = theano.function( [A], theano.tensor.nlinalg.svd(A, compute_uv=False), mode=mode_without_gpu ) f_gpu = theano.function([A], gpu_svd(A, compute_uv=False), mode=mode_with_gpu) A_val = rand(50, 100).astype("float32") utt.assert_allclose(f_cpu(A_val), f_gpu(A_val)) A_val = rand(100, 50).astype("float32") utt.assert_allclose(f_cpu(A_val), f_gpu(A_val))
def test_gpu_singular_values(self): A = theano.tensor.fmatrix("A") f_cpu = theano.function( [A], theano.tensor.nlinalg.svd(A, compute_uv=False), mode=mode_without_gpu) f_gpu = theano.function( [A], gpu_svd(A, compute_uv=False), mode=mode_with_gpu) A_val = rand(50, 100).astype('float32') utt.assert_allclose(f_cpu(A_val), f_gpu(A_val)) A_val = rand(100, 50).astype('float32') utt.assert_allclose(f_cpu(A_val), f_gpu(A_val))
def run_gpu_svd(self, A_val, full_matrices=True, compute_uv=True): A = theano.tensor.fmatrix("A") f = theano.function( [A], gpu_svd(A, full_matrices=full_matrices, compute_uv=compute_uv), mode=mode_with_gpu) return f(A_val)