def testMeshgridExecution(self): a = arange(5, chunk_size=2) b = arange(6, 12, chunk_size=3) c = arange(12, 19, chunk_size=4) A, B, C = meshgrid(a, b, c) A_res = self.executor.execute_tensor(A, concat=True)[0] A_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19))[0] np.testing.assert_equal(A_res, A_expected) B_res = self.executor.execute_tensor(B, concat=True)[0] B_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19))[1] np.testing.assert_equal(B_res, B_expected) C_res = self.executor.execute_tensor(C, concat=True)[0] C_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19))[2] np.testing.assert_equal(C_res, C_expected) A, B, C = meshgrid(a, b, c, indexing='ij') A_res = self.executor.execute_tensor(A, concat=True)[0] A_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19), indexing='ij')[0] np.testing.assert_equal(A_res, A_expected) B_res = self.executor.execute_tensor(B, concat=True)[0] B_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19), indexing='ij')[1] np.testing.assert_equal(B_res, B_expected) C_res = self.executor.execute_tensor(C, concat=True)[0] C_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19), indexing='ij')[2] np.testing.assert_equal(C_res, C_expected) A, B, C = meshgrid(a, b, c, sparse=True) A_res = self.executor.execute_tensor(A, concat=True)[0] A_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19), sparse=True)[0] np.testing.assert_equal(A_res, A_expected) B_res = self.executor.execute_tensor(B, concat=True)[0] B_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19), sparse=True)[1] np.testing.assert_equal(B_res, B_expected) C_res = self.executor.execute_tensor(C, concat=True)[0] C_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19), sparse=True)[2] np.testing.assert_equal(C_res, C_expected) A, B, C = meshgrid(a, b, c, indexing='ij', sparse=True) A_res = self.executor.execute_tensor(A, concat=True)[0] A_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19), indexing='ij', sparse=True)[0] np.testing.assert_equal(A_res, A_expected) B_res = self.executor.execute_tensor(B, concat=True)[0] B_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19), indexing='ij', sparse=True)[1] np.testing.assert_equal(B_res, B_expected) C_res = self.executor.execute_tensor(C, concat=True)[0] C_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19), indexing='ij', sparse=True)[2] np.testing.assert_equal(C_res, C_expected)
def test_meshgrid_execution(setup): a = arange(5, chunk_size=2) b = arange(6, 12, chunk_size=3) c = arange(12, 19, chunk_size=4) A, B, C = meshgrid(a, b, c) A_res = A.execute().fetch() A_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19))[0] np.testing.assert_equal(A_res, A_expected) B_res = B.execute().fetch() B_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19))[1] np.testing.assert_equal(B_res, B_expected) C_res = C.execute().fetch() C_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19))[2] np.testing.assert_equal(C_res, C_expected) A, B, C = meshgrid(a, b, c, indexing='ij') A_res = A.execute().fetch() A_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19), indexing='ij')[0] np.testing.assert_equal(A_res, A_expected) B_res = B.execute().fetch() B_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19), indexing='ij')[1] np.testing.assert_equal(B_res, B_expected) C_res = C.execute().fetch() C_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19), indexing='ij')[2] np.testing.assert_equal(C_res, C_expected) A, B, C = meshgrid(a, b, c, sparse=True) A_res = A.execute().fetch() A_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19), sparse=True)[0] np.testing.assert_equal(A_res, A_expected) B_res = B.execute().fetch() B_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19), sparse=True)[1] np.testing.assert_equal(B_res, B_expected) C_res = C.execute().fetch() C_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19), sparse=True)[2] np.testing.assert_equal(C_res, C_expected) A, B, C = meshgrid(a, b, c, indexing='ij', sparse=True) A_res = A.execute().fetch() A_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19), indexing='ij', sparse=True)[0] np.testing.assert_equal(A_res, A_expected) B_res = B.execute().fetch() B_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19), indexing='ij', sparse=True)[1] np.testing.assert_equal(B_res, B_expected) C_res = C.execute().fetch() C_expected = np.meshgrid(np.arange(5), np.arange(6, 12), np.arange(12, 19), indexing='ij', sparse=True)[2] np.testing.assert_equal(C_res, C_expected)