Ejemplo n.º 1
0
    def testViewDataOnAtleast2d(self):
        a = atleast_2d(ones(10, chunk_size=5))
        b = add(a[:, :5], 1, out=a[:, 5:])

        npa = np.atleast_2d(np.ones(10))
        npb = np.add(npa[:, :5], 1, out=npa[:, 5:])

        np.testing.assert_array_equal(b.execute(), npb)
        np.testing.assert_array_equal(a.execute(), npa)
Ejemplo n.º 2
0
    def testViewDataOnAtleast2d(self):
        data = np.random.rand(10)
        a = atleast_2d(tensor(data, chunk_size=5))
        b = add(a[:, :5], 1, out=a[:, 5:])

        npa = np.atleast_2d(data.copy())
        npb = np.add(npa[:, :5], 1, out=npa[:, 5:])

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