Esempio n. 1
0
    def testElementwise(self):
        t1 = ones((10000, 5000), chunk_size=500, gpu=True)
        t2 = ones(5000, chunk_size=500, gpu=True)
        t = (t1 - t2) / sqrt(t2 * (1 - t2) * len(t2))

        g = t.build_graph(tiled=True)
        RuntimeOptimizer(g, self.executor._engine).optimize([], False)
        self.assertTrue(any(n.op.__class__.__name__ == 'TensorCpFuseChunk' for n in g))

        c = next(n for n in g if n.op.__class__.__name__ == 'TensorCpFuseChunk')
        self.assertGreater(len(_evaluate(c)), 1)
Esempio n. 2
0
    def testElementwise(self):
        t1 = ones((10000, 5000), chunk_size=500, gpu=True)
        t2 = ones(5000, chunk_size=500, gpu=True)
        t = (t1 - t2) / sqrt(t2 * (1 - t2) * len(t2))

        g = t.build_graph(tiled=True)
        graph = self.executor._preprocess(g, [])
        self.assertTrue(any(n.op.__class__.__name__ == 'TensorCpFuseChunk' for n in graph))

        c = next(n for n in graph if n.op.__class__.__name__ == 'TensorCpFuseChunk')
        print(_evaluate(c))