Exemplo n.º 1
0
    def testToCPUExecution(self):
        raw = np.random.rand(10, 10)
        x = tensor(raw, chunk_size=3, gpu=True)

        cx = to_cpu(x)

        res = self.executor.execute_tensor(cx, concat=True)[0]
        np.testing.assert_array_equal(res, raw)
Exemplo n.º 2
0
def test_to_cpu():
    x = tensor(np.random.rand(10, 10), chunk_size=3, gpu=True)

    cx = to_cpu(x)

    assert cx.dtype == x.dtype
    assert cx.order == x.order
    assert cx.op.gpu is False

    cx, x = tile(cx, x)

    assert cx.chunks[0].dtype == x.chunks[0].dtype
    assert cx.chunks[0].order == x.chunks[0].order
    assert cx.chunks[0].op.gpu is False
Exemplo n.º 3
0
    def testToCPU(self):
        x = tensor(np.random.rand(10, 10), chunk_size=3, gpu=True)

        cx = to_cpu(x)

        self.assertEqual(cx.dtype, x.dtype)
        self.assertEqual(cx.order, x.order)
        self.assertFalse(cx.op.gpu)

        cx.tiles()

        self.assertEqual(cx.chunks[0].dtype, x.chunks[0].dtype)
        self.assertEqual(cx.chunks[0].order, x.chunks[0].order)
        self.assertFalse(cx.chunks[0].op.gpu)