Skip to content

Commit 536cc49

Browse files
committed
WIP: array API for cg
[skip ci]
1 parent 4d65e68 commit 536cc49

File tree

6 files changed

+281
-166
lines changed

6 files changed

+281
-166
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.bench]
@@ -82,8 +82,8 @@ features = ["run-deps", "test-deps", "mkl", "torch-cpu", "torch-cpu-tasks"]
8282
solve-group = "array-api-cpu"
8383

8484
[environments.array-api-cpu]
85-
# tasks: test-cpu
86-
features = ["run-deps", "test-deps", "test-cpu", "mkl", "array_api_strict", "dask", "jax-cpu", "marray", "torch-cpu"]
85+
# tasks: test-cpu, ipython-cpu
86+
features = ["run-deps", "test-deps", "test-cpu", "mkl", "array_api_strict", "dask", "jax-cpu", "marray", "torch-cpu", "ipython-dep", "ipython-cpu-task"]
8787
solve-group = "array-api-cpu"
8888

8989
[environments.build-cuda]
@@ -239,14 +239,20 @@ description = "Build the documentation"
239239

240240
### IPython ###
241241

242-
[feature.ipython.dependencies]
242+
[feature.ipython-dep.dependencies]
243243
ipython = "*"
244244

245-
[feature.ipython.tasks.ipython]
245+
[feature.ipython-task.tasks.ipython]
246246
cmd = "spin ipython --no-build"
247247
depends-on = "build"
248248
description = "Launch IPython"
249249

250+
[feature.ipython-cpu-task.tasks.ipython-cpu]
251+
cmd = "spin ipython --build-dir=build-cpu --no-build"
252+
depends-on = "build-cpu"
253+
env.SCIPY_ARRAY_API = "1"
254+
description = "Launch IPython"
255+
250256

251257
### Benchmarking ###
252258

scipy/_lib/_array_api.py

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

0 commit comments

Comments
 (0)