Esempio n. 1
0
    def testViewDataOnAtleast3d(self):
        a = atleast_3d(ones((10, 20), chunk_size=5))
        b = a[:, :5, :10][0]
        c = add(b[:4], b[1:], out=a[0, 16:])

        npa = np.atleast_3d(np.ones((10, 20)))
        npb = npa[:, :5, :10][0]
        npc = np.add(npb[:4], npb[1:], out=npa[0, 16:])

        np.testing.assert_array_equal(c.execute(), npc)
        np.testing.assert_array_equal(b.execute(), npb)
        np.testing.assert_array_equal(a.execute(), npa)
Esempio n. 2
0
    def testViewDataOnAtleast3d(self):
        data = np.random.rand(10, 20)
        a = atleast_3d(tensor(data, chunk_size=5))
        b = a[:, :5, :10][0]
        c = add(b[:4], b[1:], out=a[0, 16:])

        npa = np.atleast_3d(data.copy())
        npb = npa[:, :5, :10][0]
        npc = np.add(npb[:4], npb[1:], out=npa[0, 16:])

        np.testing.assert_array_equal(c.execute(), npc)
        np.testing.assert_array_equal(b.execute(), npb)
        np.testing.assert_array_equal(a.execute(), npa)