def test_full_execution(setup): t = full((2, 2), 1, dtype='f4', chunk_size=1) res = t.execute().fetch() np.testing.assert_array_equal(res, np.full((2, 2), 1, dtype='f4')) t = full((2, 2), [1, 2], dtype='f8', chunk_size=1) res = t.execute().fetch() np.testing.assert_array_equal(res, np.full((2, 2), [1, 2], dtype='f8')) t = full((2, 2), 1, dtype='f4', chunk_size=1, order='F') res = t.execute().fetch() expected = np.full((2, 2), 1, dtype='f4', order='F') assert res.flags['C_CONTIGUOUS'] == expected.flags['C_CONTIGUOUS'] assert res.flags['F_CONTIGUOUS'] == expected.flags['F_CONTIGUOUS'] t2 = full_like(t, 10, order='F') res = t2.execute().fetch() expected = np.full((2, 2), 10, dtype='f4', order='F') np.testing.assert_array_equal(res, expected) assert res.flags['C_CONTIGUOUS'] == expected.flags['C_CONTIGUOUS'] assert res.flags['F_CONTIGUOUS'] == expected.flags['F_CONTIGUOUS']
def testFullExecution(self): t = full((2, 2), 1, dtype='f4', chunk_size=1) res = self.executor.execute_tensor(t, concat=True) np.testing.assert_array_equal(res[0], np.full((2, 2), 1, dtype='f4')) t = full((2, 2), [1, 2], dtype='f8', chunk_size=1) res = self.executor.execute_tensor(t, concat=True) np.testing.assert_array_equal(res[0], np.full((2, 2), [1, 2], dtype='f8')) t = full((2, 2), 1, dtype='f4', chunk_size=1, order='F') res = self.executor.execute_tensor(t, concat=True)[0] expected = np.full((2, 2), 1, dtype='f4', order='F') self.assertEqual(res.flags['C_CONTIGUOUS'], expected.flags['C_CONTIGUOUS']) self.assertEqual(res.flags['F_CONTIGUOUS'], expected.flags['F_CONTIGUOUS']) t2 = full_like(t, 10, order='F') res = self.executor.execute_tensor(t2, concat=True)[0] expected = np.full((2, 2), 10, dtype='f4', order='F') np.testing.assert_array_equal(res, expected) self.assertEqual(res.flags['C_CONTIGUOUS'], expected.flags['C_CONTIGUOUS']) self.assertEqual(res.flags['F_CONTIGUOUS'], expected.flags['F_CONTIGUOUS'])
def testFullExecution(self): t = full((2, 2), 1, dtype='f4', chunk_size=1) res = self.executor.execute_tensor(t, concat=True) self.assertTrue(np.array_equal(res[0], np.full((2, 2), 1, dtype='f4'))) t = full((2, 2), [1, 2], dtype='f8', chunk_size=1) res = self.executor.execute_tensor(t, concat=True) self.assertTrue( np.array_equal(res[0], np.full((2, 2), [1, 2], dtype='f8')))