Beispiel #1
0
    def testExtractExecution(self):
        data = np.arange(12).reshape((3, 4))
        a = tensor(data, chunk_size=2)
        condition = mod(a, 3) == 0

        t = extract(condition, a)

        res = self.executor.execute_tensor(t, concat=True)[0]
        expected = np.extract(np.mod(data, 3) == 0, data)
        np.testing.assert_array_equal(res, expected)
def test_extract_execution(setup):
    data = np.arange(12).reshape((3, 4))
    a = tensor(data, chunk_size=2)
    condition = mod(a, 3) == 0

    t = extract(condition, a)

    res = t.execute().fetch()
    expected = np.extract(np.mod(data, 3) == 0, data)
    np.testing.assert_array_equal(res, expected)