Exemple #1
0
def test_gamma():
    m = 256
    n = 128
    a = np.array(np.random.rand(m, n)*5, dtype=np.float32, order='F')
    b = np.array(np.random.rand(m, n)*5, dtype=np.float32, order='F')

    from scipy.special import gamma
    c = gamma(a)

    m1 = cm.CUDAMatrix(a)
    m2 = cm.CUDAMatrix(b)
    cm.gamma(m1, target = m2)
    cm.gamma(m1)

    m1.copy_to_host()
    m2.copy_to_host()

    assert np.max(np.abs(c - m1.numpy_array)) < 10**-2, "Error in cudamat.gamma exceeded threshold"
    assert np.max(np.abs(c - m2.numpy_array)) < 10**-2, "Error in cudamat.gamma exceeded threshold"
Exemple #2
0
def test_gamma():
    m = 256
    n = 128
    a = np.array(np.random.rand(m, n)*5, dtype=np.float32, order='F')
    b = np.array(np.random.rand(m, n)*5, dtype=np.float32, order='F')

    from scipy.special import gamma
    c = gamma(a)

    m1 = cm.CUDAMatrix(a)
    m2 = cm.CUDAMatrix(b)
    cm.gamma(m1, target = m2)
    cm.gamma(m1)

    m1.copy_to_host()
    m2.copy_to_host()

    assert np.max(np.abs(c - m1.numpy_array)) < 10**-2, "Error in cudamat.gamma exceeded threshold"
    assert np.max(np.abs(c - m2.numpy_array)) < 10**-2, "Error in cudamat.gamma exceeded threshold"