Exemplo n.º 1
0
    def test_compile(self):
        m = time.time()
        cubes = [np.ones((720, 360, 12)) for _ in range(750)]
        print(f"Init: {time.time()-m}")

        m = time.time()
        cubes = [Tensor.new(t) for t in cubes]
        print(f"Create: {time.time()-m}")

        m = time.time()
        hcube = compileTensors(cubes, (720, 360, 12), (0, 720), (0, 360),
                               (0, 100))
        print(f"Read: {time.time()-m}")
        print(hcube.flatten().shape)

        self.assertTrue(True)
Exemplo n.º 2
0
 def test_id(self):
     cube = np.linspace(1, 27, 27).reshape((3, 3, 3))
     t = Tensor.new(cube)
     c = t.get()
     np.testing.assert_array_equal(cube, c)
Exemplo n.º 3
0
 def test_getter(self):
     cube = np.linspace(1, 27, 27).reshape((3, 3, 3))
     t = Tensor.new(cube)
     c = t.get(x=(0, 3), y=(0, 2), z=(0, 1))
     np.testing.assert_array_equal(cube[:, 0:2, 0], c)
Exemplo n.º 4
0
    def test_tensor(self):
        cube = np.linspace(1, 27, 27).reshape((3, 3, 3))
        t = Tensor.new(cube)
        self.files += [t.path()]

        self.assertEqual(cube[1, 1, 1], t[1, 1, 1])