Skip to content

Commit fa54350

Browse files
committed
WIP: array API for cg
[skip ci]
1 parent 99a6236 commit fa54350

File tree

6 files changed

+272
-155
lines changed

6 files changed

+272
-155
lines changed

pixi.lock

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pixi.toml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ solve-group = "default"
2626

2727
[environments.ipython]
2828
# tasks: ipython
29-
features = ["run-deps", "test-deps", "ipython"]
29+
features = ["run-deps", "test-deps", "ipython-dep", "ipython-task"]
3030
solve-group = "default"
3131

3232
[environments.build-debug]
@@ -77,8 +77,8 @@ features = ["run-deps", "test-deps", "mkl", "torch-cpu", "torch-cpu-tasks"]
7777
solve-group = "array-api-cpu"
7878

7979
[environments.array-api-cpu]
80-
# tasks: test-cpu
81-
features = ["run-deps", "test-deps", "test-cpu", "mkl", "array_api_strict", "dask", "jax-cpu", "marray", "torch-cpu"]
80+
# tasks: test-cpu, ipython-cpu
81+
features = ["run-deps", "test-deps", "test-cpu", "mkl", "array_api_strict", "dask", "jax-cpu", "marray", "torch-cpu", "ipython-dep", "ipython-cpu-task"]
8282
solve-group = "array-api-cpu"
8383

8484
[environments.build-cuda]
@@ -221,14 +221,20 @@ description = "Build the documentation"
221221

222222
### IPython ###
223223

224-
[feature.ipython.dependencies]
224+
[feature.ipython-dep.dependencies]
225225
ipython = "*"
226226

227-
[feature.ipython.tasks.ipython]
227+
[feature.ipython-task.tasks.ipython]
228228
cmd = "spin ipython --no-build"
229229
depends-on = "build"
230230
description = "Launch IPython"
231231

232+
[feature.ipython-cpu-task.tasks.ipython-cpu]
233+
cmd = "spin ipython --build-dir=build-cpu --no-build"
234+
depends-on = "build-cpu"
235+
env.SCIPY_ARRAY_API = "1"
236+
description = "Launch IPython"
237+
232238

233239
### Debugging ###
234240

scipy/_lib/_array_api.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,3 +1028,7 @@ def xp_device_type(a: Array) -> Literal["cpu", "cuda", None]:
10281028
return xp_device_type(a._meta)
10291029
# array-api-strict is a stand-in for unknown libraries; don't special-case it
10301030
return None
1031+
1032+
1033+
def xp_isscalar(x):
1034+
return np.isscalar(x) or (is_array_api_obj(x) and x.ndim == 0)

0 commit comments

Comments
 (0)