Open hameerabbasi opened 6 years ago
@jacobtomlinson got things sorta-working with NEP-18 and CuPy in an afternoon in Iris (with a strong emphasis on "kinda").
On the CuPy side you're fine. If you're on NumPy 1.16 you'll need to enable the __array_function__
interface with the following environment variable:
export NUMPY_EXPERIMENTAL_ARRAY_FUNCTION=1
If you're using Numpy 1.17 then this is on by default.
I think that most of the work here is on the Xarray side. We'll need to remove things like explicit type checks.
@rabernat I can attend remotely.
We're at the point where this could be hacked together pretty quickly:
__array_function__
attribute is probably a good heuristic for duck arrays (it's what dask is using).__array_function__
is enabled) instead of our current Dask/NumPy versions. Fortunately, pretty much all this logic lives in one place, in xarray.core.duck_array_ops
.
In hope of cleaner dask and sparse support (pydata/sparse#1), I wanted to suggest hooks for XArray operations.
Something like the following:
Functions would work something like the following: (the register would fall back to Numpy if nothing is found)
I would argue that this should be in Numpy, but it's a huge project to put it there.