diff --git a/.github/workflows/python.yaml b/.github/workflows/python.yaml index 369c1dffc..4a1327601 100644 --- a/.github/workflows/python.yaml +++ b/.github/workflows/python.yaml @@ -88,7 +88,7 @@ jobs: include: - { os: ubuntu-latest, module: _mars/dataframe, python-version: 3.11 } - { os: ubuntu-latest, module: learn, python-version: 3.11 } - - { os: ubuntu-latest, module: mars-core, python-version: 3.12 } + - { os: ubuntu-latest, module: mars-core, python-version: 3.9 } - { os: ubuntu-20.04, module: hadoop, python-version: 3.9 } - { os: ubuntu-latest, module: vineyard, python-version: 3.11 } - { os: ubuntu-latest, module: external-storage, python-version: 3.11 } @@ -96,7 +96,7 @@ jobs: # - { os: ubuntu-latest, module: compatibility, python-version: 3.9 } - { os: ubuntu-latest, module: doc-build, python-version: 3.11 } - { os: self-hosted, module: gpu, python-version: 3.11} - - { os: ubuntu-latest, module: jax, python-version: 3.11 } + - { os: ubuntu-latest, module: jax, python-version: 3.9 } # a self-hosted runner which needs computing resources, activate when necessary # - { os: juicefs-ci, module: kubernetes-juicefs, python-version: 3.9 } # - { os: ubuntu-latest, module: slurm, python-version: 3.9 } diff --git a/python/xorbits/_mars/tensor/arithmetic/tests/test_arithmetic_execution.py b/python/xorbits/_mars/tensor/arithmetic/tests/test_arithmetic_execution.py index 98900b1bf..c71719470 100644 --- a/python/xorbits/_mars/tensor/arithmetic/tests/test_arithmetic_execution.py +++ b/python/xorbits/_mars/tensor/arithmetic/tests/test_arithmetic_execution.py @@ -339,7 +339,7 @@ def test_arctan2_execution(setup): assert y.issparse() is True result = y.execute().fetch() - np.testing.assert_equal(result, np.arctan2(raw2.A, raw2.A)) + np.testing.assert_equal(result, np.arctan2(raw2.todense(), raw2.todense())) y = arctan2(0, raw2) diff --git a/python/xorbits/_mars/tensor/indexing/tests/test_indexing_execution.py b/python/xorbits/_mars/tensor/indexing/tests/test_indexing_execution.py index f23f99c7a..51088cf96 100644 --- a/python/xorbits/_mars/tensor/indexing/tests/test_indexing_execution.py +++ b/python/xorbits/_mars/tensor/indexing/tests/test_indexing_execution.py @@ -719,7 +719,7 @@ def test_fill_diagonal_execution(setup): def copy(x): if hasattr(x, "nnz"): # sparse - return x.A + return x.todense() else: return x.copy() diff --git a/python/xorbits/_mars/tensor/linalg/tests/test_linalg_execution.py b/python/xorbits/_mars/tensor/linalg/tests/test_linalg_execution.py index 33a4e32a1..a147272d5 100644 --- a/python/xorbits/_mars/tensor/linalg/tests/test_linalg_execution.py +++ b/python/xorbits/_mars/tensor/linalg/tests/test_linalg_execution.py @@ -404,7 +404,7 @@ def test_lu_execution(setup): t = P.dot(L).dot(U) res = t.execute().fetch() - np.testing.assert_array_almost_equal(data.A, res) + np.testing.assert_array_almost_equal(data.todense(), res) def test_solve_triangular(setup): diff --git a/python/xorbits/_mars/tensor/merge/tests/test_merge_execution.py b/python/xorbits/_mars/tensor/merge/tests/test_merge_execution.py index 2262a0e2a..a9534519d 100644 --- a/python/xorbits/_mars/tensor/merge/tests/test_merge_execution.py +++ b/python/xorbits/_mars/tensor/merge/tests/test_merge_execution.py @@ -56,7 +56,9 @@ def test_concatenate_execution(setup): d = concatenate([a, b, c], axis=-1) res = d.execute().fetch() - expected = np.concatenate([a_data.A, b_data.A, c_data.A], axis=-1) + expected = np.concatenate( + [a_data.todense(), b_data.todense(), c_data.todense()], axis=-1 + ) np.testing.assert_array_equal(res.toarray(), expected) diff --git a/python/xorbits/_mars/tensor/reduction/tests/test_reduction_execution.py b/python/xorbits/_mars/tensor/reduction/tests/test_reduction_execution.py index e7af0da66..bdac2f5c8 100644 --- a/python/xorbits/_mars/tensor/reduction/tests/test_reduction_execution.py +++ b/python/xorbits/_mars/tensor/reduction/tests/test_reduction_execution.py @@ -106,11 +106,11 @@ def test_max_min_execution(setup): assert raw.min() == arr.min().execute().fetch() np.testing.assert_almost_equal( - raw.max(axis=1).A.ravel(), arr.max(axis=1).execute().fetch().toarray() + raw.max(axis=1).todense().ravel(), arr.max(axis=1).execute().fetch().toarray() ) assert arr.max(axis=1).issparse() is True np.testing.assert_almost_equal( - raw.min(axis=1).A.ravel(), arr.min(axis=1).execute().fetch().toarray() + raw.min(axis=1).todense().ravel(), arr.min(axis=1).execute().fetch().toarray() ) assert arr.min(axis=1).issparse() is True @@ -435,18 +435,20 @@ def test_nan_reduction(setup): raw[:3, :3] = np.nan arr = tensor(raw, chunk_size=6) - assert pytest.approx(np.nansum(raw.A)) == nansum(arr).execute().fetch() - assert pytest.approx(np.nanprod(raw.A)) == nanprod(arr).execute().fetch() - assert pytest.approx(np.nanmax(raw.A)) == nanmax(arr).execute().fetch() - assert pytest.approx(np.nanmin(raw.A)) == nanmin(arr).execute().fetch() - assert pytest.approx(np.nanmean(raw.A)) == nanmean(arr).execute().fetch() - assert pytest.approx(np.nanvar(raw.A)) == nanvar(arr).execute().fetch() + assert pytest.approx(np.nansum(raw.todense())) == nansum(arr).execute().fetch() + assert pytest.approx(np.nanprod(raw.todense())) == nanprod(arr).execute().fetch() + assert pytest.approx(np.nanmax(raw.todense())) == nanmax(arr).execute().fetch() + assert pytest.approx(np.nanmin(raw.todense())) == nanmin(arr).execute().fetch() + assert pytest.approx(np.nanmean(raw.todense())) == nanmean(arr).execute().fetch() + assert pytest.approx(np.nanvar(raw.todense())) == nanvar(arr).execute().fetch() assert ( - pytest.approx(np.nanvar(raw.A, ddof=1)) == nanvar(arr, ddof=1).execute().fetch() + pytest.approx(np.nanvar(raw.todense(), ddof=1)) + == nanvar(arr, ddof=1).execute().fetch() ) - assert pytest.approx(np.nanstd(raw.A)) == nanstd(arr).execute().fetch() + assert pytest.approx(np.nanstd(raw.todense())) == nanstd(arr).execute().fetch() assert ( - pytest.approx(np.nanstd(raw.A, ddof=1)) == nanstd(arr, ddof=1).execute().fetch() + pytest.approx(np.nanstd(raw.todense(), ddof=1)) + == nanstd(arr, ddof=1).execute().fetch() ) arr = nansum(1) @@ -471,8 +473,8 @@ def test_cum_reduction(setup): res1 = arr.cumsum(axis=1).execute().fetch() res2 = arr.cumprod(axis=1).execute().fetch() - expected1 = raw.A.cumsum(axis=1) - expected2 = raw.A.cumprod(axis=1) + expected1 = raw.todense().cumsum(axis=1) + expected2 = raw.todense().cumprod(axis=1) assert np.allclose(res1, expected1) assert np.allclose(res2, expected2) @@ -530,8 +532,8 @@ def test_nan_cum_reduction(setup): res1 = nancumsum(arr, axis=1).execute().fetch() res2 = nancumprod(arr, axis=1).execute().fetch() - expected1 = np.nancumsum(raw.A, axis=1) - expected2 = np.nancumprod(raw.A, axis=1) + expected1 = np.nancumsum(raw.todense(), axis=1) + expected2 = np.nancumprod(raw.todense(), axis=1) assert np.allclose(res1, expected1) is True assert np.allclose(res2, expected2) is True @@ -596,19 +598,19 @@ def test_count_nonzero_execution(setup): t = count_nonzero(arr) res = t.execute().fetch() - expected = np.count_nonzero(raw.A) + expected = np.count_nonzero(raw.todense()) np.testing.assert_equal(res, expected) t = count_nonzero(arr, axis=0) res = t.execute().fetch() - expected = np.count_nonzero(raw.A, axis=0) + expected = np.count_nonzero(raw.todense(), axis=0) np.testing.assert_equal(res, expected) t = count_nonzero(arr, axis=1) res = t.execute().fetch() - expected = np.count_nonzero(raw.A, axis=1) + expected = np.count_nonzero(raw.todense(), axis=1) np.testing.assert_equal(res, expected) # test string dtype