def test_rand():
    A = gpu.rand(100, 100)
    B = A.tocpu()
    assert np.mean(B) > 0.45 and np.mean(B) < 0.55
    assert np.var(B) > 0.08 and np.var(B) < 0.085

    gpu.setRandomState(1234)
    A1 = gpu.rand(1000, 1000)
    gpu.setRandomState(1234)
    A2 = gpu.rand(1000, 1000)
    B1 = A1.tocpu()
    B2 = A2.tocpu()

    t.assert_array_equal(B1, B2, "Seed not working!")
Exemplo n.º 2
0
def test_rand():
    A = gpu.rand(100,100)
    B = A.tocpu()
    assert np.mean(B) > 0.45 and np.mean(B) < 0.55
    assert np.var(B) > 0.08 and np.var(B) < 0.085

    gpu.setRandomState(1234)
    A1 = gpu.rand(1000,1000)
    gpu.setRandomState(1234)
    A2 = gpu.rand(1000,1000)
    B1 = A1.tocpu()
    B2 = A2.tocpu()

    t.assert_array_equal(B1, B2, "Seed not working!")
def test_randn():
    A = gpu.randn(100, 100)
    B = A.tocpu()
    print np.mean(B)
    print np.var(B)
    assert np.mean(B) > -0.05 and np.mean(B) < 0.05
    assert np.var(B) > 0.92 and np.var(B) < 1.08

    gpu.setRandomState(1234)
    A1 = gpu.randn(1000, 1000)
    gpu.setRandomState(1234)
    A2 = gpu.randn(1000, 1000)
    B1 = A1.tocpu()
    B2 = A2.tocpu()

    t.assert_array_equal(B1, B2, "Seed not working!")
Exemplo n.º 4
0
def test_randn():
    A = gpu.randn(100,100)
    B = A.tocpu()
    print np.mean(B)
    print np.var(B)
    assert np.mean(B) > -0.05 and np.mean(B) < 0.05
    assert np.var(B) > 0.92 and np.var(B) < 1.08

    gpu.setRandomState(1234)
    A1 = gpu.randn(1000,1000)
    gpu.setRandomState(1234)
    A2 = gpu.randn(1000,1000)
    B1 = A1.tocpu()
    B2 = A2.tocpu()

    t.assert_array_equal(B1, B2, "Seed not working!")