Пример #1
0
def test_vdot():
    m = 64
    n = 64
    a = np.array(np.random.randn(m, n), dtype=np.float32, order='F')
    b = np.array(np.random.randn(m, n), dtype=np.float32, order='F')

    true_res = np.vdot(a, b)

    m1 = cm.CUDAMatrix(a)
    m2 = cm.CUDAMatrix(b)

    res = cm.vdot(m1, m2)

    assert np.abs(res - true_res) < 10**-2, "Error in CUDAMatrix.vdot exceeded threshold"
Пример #2
0
def test_vdot():
    m = 64
    n = 64
    a = np.array(np.random.randn(m, n), dtype=np.float32, order='F')
    b = np.array(np.random.randn(m, n), dtype=np.float32, order='F')

    true_res = np.vdot(a, b)

    m1 = cm.CUDAMatrix(a)
    m2 = cm.CUDAMatrix(b)

    res = cm.vdot(m1, m2)

    assert np.abs(res - true_res) < 10**-2, "Error in CUDAMatrix.vdot exceeded threshold"