-
Notifications
You must be signed in to change notification settings - Fork 46
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Allow libraries to negotiate that they understand e.g. NumPy arrays? #586
Comments
Doesn't this require n-way multiple dispatch in general? How does |
(As a correction from the above, accepting NumPy and maybe CuPy arrays can be interesting also for JAX/torch/...) It came up again in SciPy now, so going to list some references:
IMO it is a mistake not to provision for this and there is a reason everyone seems to have some (basic) solution. Yes, I also think that this should be very restrictive/conservative (but that mainly a documentation thing in most schemes). Of course what is actually important is the downstream need/ask, because array-api should adapt to those needs. From my side, I think there is enough evidence. We can say its not yet enough, but that can clearly change at this point in time. |
There's several questions one could ask here:
In general, yes. It's pretty well explained in this section of NEP 18. Basically " subclasses before superclasses, and otherwise left to right", and then let each handler decide whether it can deal with foreign array objects or if it wants to return |
I thought we decided that this kind of usage is UB (#399) but it might actually be good to at least revisit and reconfirm this. Another use case is pint+dask+cupy+xarray: pydata/xarray#7721 |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Today dask came up a few times and also the possibility of a fallback to
__array_function__
for transitioning at least.This must have come up before, but did we ever discuss an API like:
which is not really important if you think about numpy, jax, torch, tensorflow: I don't think you should mix them really! But it seems more becomes interesting if we start talking about dask or quantities which are designed as wrappers?
The answer can be that this is not our problem have to coerce manually. In the NumPy world, we could actually just write
get_namespace
as:(and assume others will return their namespace, since in practice everyone has it de-facto)
The text was updated successfully, but these errors were encountered: