예제 #1
0
    def testViewDataOnSwapaxes(self):
        a = ones((10, 20), chunk_size=6)
        b = swapaxes(a, 1, 0)
        a[1] = 10

        npa = np.ones((10, 20))
        npb = np.swapaxes(npa, 1, 0)
        npa[1] = 10

        np.testing.assert_array_equal(b.execute(), npb)
        np.testing.assert_array_equal(a.execute(), npa)
예제 #2
0
    def testViewDataOnSwapaxes(self):
        data = np.random.rand(10, 20)
        a = tensor(data, chunk_size=6)
        b = swapaxes(a, 1, 0)
        a[1] = 10

        npa = data.copy()
        npb = np.swapaxes(npa, 1, 0)
        npa[1] = 10

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