def testUnravelExecution(self): a = tensor([22, 41, 37], chunk_size=1) t = stack(unravel_index(a, (7, 6))) res = self.executor.execute_tensor(t, concat=True)[0] expected = np.stack(np.unravel_index([22, 41, 37], (7, 6))) np.testing.assert_array_equal(res, expected)
def testUnravelIndex(self): indices = tensor([22, 41, 37], chunks=1) t = unravel_index(indices, (7, 6)) self.assertEqual(len(t), 2) [r.tiles() for r in t] self.assertEqual(len(t[0].chunks), 3) self.assertEqual(len(t[1].chunks), 3)
def testUnravelIndex(self): indices = tensor([22, 41, 37], chunk_size=1) t = unravel_index(indices, (7, 6)) self.assertEqual(len(t), 2) self.assertEqual(calc_shape(t[0]), t[0].shape) self.assertEqual(calc_shape(t[1]), t[1].shape) [r.tiles() for r in t] self.assertEqual(len(t[0].chunks), 3) self.assertEqual(len(t[1].chunks), 3) self.assertEqual(calc_shape(t[0].chunks[0]), t[0].chunks[0].shape) self.assertEqual(calc_shape(t[1].chunks[0]), t[1].chunks[0].shape)