def testEmptyExecution(self): t = empty((20, 30), dtype='i8', chunk_size=5) res = self.executor.execute_tensor(t, concat=True) self.assertEqual(res[0].shape, (20, 30)) self.assertEqual(res[0].dtype, np.int64) t = empty((20, 30), chunk_size=5) res = self.executor.execute_tensor(t, concat=True) self.assertEqual(res[0].shape, (20, 30)) self.assertEqual(res[0].dtype, np.float64) t2 = empty_like(t) res = self.executor.execute_tensor(t2, concat=True) self.assertEqual(res[0].shape, (20, 30)) self.assertEqual(res[0].dtype, np.float64) t = empty((20, 30), dtype='i8', chunk_size=5, order='F') res = self.executor.execute_tensor(t, concat=True)[0] expected = np.empty((20, 30), dtype='i8', order='F') self.assertEqual(res.flags['C_CONTIGUOUS'], expected.flags['C_CONTIGUOUS']) self.assertEqual(res.flags['F_CONTIGUOUS'], expected.flags['F_CONTIGUOUS'])
def testEmptyExecution(self): t = empty((20, 30), dtype='i8', chunk_size=5) res = self.executor.execute_tensor(t, concat=True) self.assertEqual(res[0].shape, (20, 30)) self.assertEqual(res[0].dtype, np.int64) t = empty((20, 30), chunk_size=5) res = self.executor.execute_tensor(t, concat=True) self.assertEqual(res[0].shape, (20, 30)) self.assertEqual(res[0].dtype, np.float64) t2 = empty_like(t) res = self.executor.execute_tensor(t2, concat=True) self.assertEqual(res[0].shape, (20, 30)) self.assertEqual(res[0].dtype, np.float64)
def test_empty_execution(setup): t = empty((20, 30), dtype='i8', chunk_size=5) res = t.execute().fetch() assert res.shape == (20, 30) assert res.dtype == np.int64 t = empty((20, 30), chunk_size=10) res = t.execute().fetch() assert res.shape == (20, 30) assert res.dtype == np.float64 t2 = empty_like(t) res = t2.execute().fetch() assert res.shape == (20, 30) assert res.dtype == np.float64 t = empty((20, 30), dtype='i8', chunk_size=5, order='F') res = t.execute().fetch() expected = np.empty((20, 30), dtype='i8', order='F') assert res.flags['C_CONTIGUOUS'] == expected.flags['C_CONTIGUOUS'] assert res.flags['F_CONTIGUOUS'] == expected.flags['F_CONTIGUOUS']