8000 NEP: add NEP 56 on array API standard support in main namespace by rgommers · Pull Request #25542 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

NEP: add NEP 56 on array API standard support in main namespace #25542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Feb 28, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add the in-place "no unsafe casting" item to the not adopted section
Also a few smaller textual changes.

[skip actions] [skip cirrus] [skip azp]
  • Loading branch information
rgommers committed Jan 18, 2024
commit d9310c73c7af3ad031f5677d6d6c428c9f596be1
26 changes: 20 additions & 6 deletions doc/neps/nep-0056-array-api-main-namespace.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ NEP 56 — Array API standard support in NumPy's main namespace
Abstract
--------

This NEP proposes adding full support for the 2022.12 version of the array API
standard in NumPy's main namespace for the 2.0 release.
This NEP proposes adding nearly full support for the 2022.12 version of the
array API standard in NumPy's main namespace for the 2.0 release.

Adoption in the main namespace has a number of advantages; most importantly for
libraries that depend on NumPy and want to start supporting other array
Expand Down Expand Up @@ -227,9 +227,10 @@ their experience of using a stack of Python packages for scientific computing
or data science more seamless.

Finally, for authors of other array libraries as well as tools like Numba,
array API standard support should save them time. The design rules ([3]_), and
in some cases new APIs like the ``unique_*`` ones, are easier to implement on
GPU and for JIT compilers as a result of more predictable behavior.
API improvements which align NumPy with the array API standard will also save
them time. The design rules ([3]_), and in some cases new APIs like the
``unique_*`` ones, are easier to imp 8000 lement on GPU and for JIT compilers as a
result of more predictable behavior.


Backward compatibility
Expand All @@ -250,7 +251,6 @@ Raising errors for consistency/strictness includes:
2. Making ``cross`` error on size-2 vectors (only size-3 vectors are supported),
3. Making ``solve`` error on ambiguous input (only accept ``x2`` as vector if ``x2.ndim == 1``),
4. ``outer`` raises rather than flattens on >1-D inputs,
5. In-place operators are disallowed when the left-hand side would be promoted.

Dtypes of returned arrays for some element-wise functions and reductions
includes functions where dtypes need to be preserved: ``ceil``, ``floor``, and
Expand Down Expand Up @@ -493,6 +493,20 @@ to follow (at least at this time). These are:
already compliant), however there is no need to rush this change - doing so
for 2.0 would be unnecessarily disruptive.*

4. The requirement "An in-place operation must have the same behavior
(including special cases) as its respective binary (i.e., two operand,
non-assignment) operation" (excluding the effect on views).

*Rationale: the requirement is very reasonable and probably expected
behavior for most NumPy users. However, deprecating unsafe casts for
in-place operators is a change for which the impact is hard to predict.
Hence this needs to be investigated first, and then if the impact is low
enough it may be possible to deprecate the current behavior according to
NumPy's normal backwards compatibility guidelines.*

This topic is tracked in
`gh-25621 <https://github.com/numpy/numpy/issues/25621>`__.


Related work
------------
Expand Down
0