Exemplo n.º 1
0
    def test_py2java_array(self, java_sc, py_sc):
        data = [np.zeros((20, 10)) for _ in range(100)]

        py_rdd = py_sc.parallelize(data)
        java_rdd = py2javaArrayRDD(py_rdd, java_sc)

        data2 = java_rdd.collect()
        n = data2.size()
        assert n == len(data)
        s = 0.
        for i in range(n):
            s += float(jp.sum(data2.get(i)))
        assert s == 0.
def test_array_creation():
    a = jp.zeros((32, 10))
    assert int(jp.sum(a)) == 0
    a = jp.ones((32, 12))
    assert int(jp.sum(a)) == 32 * 12
def test_array_creation():
    a = jp.zeros((32, 10))
    assert int(jp.sum(a)) == 0
    a = jp.ones((32, 12))
    assert int(jp.sum(a)) == 32 * 12