Пример #1
0
    def testUnion1dExecution(self):
        rs = np.random.RandomState(0)
        raw1 = rs.random(10)
        raw2 = rs.random(9)

        t1 = tensor(raw1, chunk_size=3)
        t2 = tensor(raw2, chunk_size=4)

        t = union1d(t1, t2, aggregate_size=1)
        res = self.executor.execute_tensor(t, concat=True)[0]
        expected = np.union1d(raw1, raw2)
        np.testing.assert_array_equal(res, expected)

        t = union1d(t1, t2)
        res = self.executor.execute_tensor(t, concat=True)[0]
        expected = np.union1d(raw1, raw2)
        np.testing.assert_array_equal(res, expected)
Пример #2
0
def test_union1d_execution(setup):
    rs = np.random.RandomState(0)
    raw1 = rs.random(10)
    raw2 = rs.random(9)

    t1 = tensor(raw1, chunk_size=3)
    t2 = tensor(raw2, chunk_size=4)

    t = union1d(t1, t2, aggregate_size=1)
    res = t.execute().fetch()
    expected = np.union1d(raw1, raw2)
    np.testing.assert_array_equal(res, expected)

    t = union1d(t1, t2)
    res = t.execute().fetch()
    expected = np.union1d(raw1, raw2)
    np.testing.assert_array_equal(res, expected)