The discussion for this issue started in cupy/cupy#2029, please refer to it for all the details.
Currently, CuPy creates aliases from some NumPy C functions that use the __array_function__ dispatch. This causes an infinite loop since CuPy keeps on calling the NumPy function, and this dispatches the CuPy alias. Note that the same case may apply to any other libraries that implementation the __array_function__ protocol.
Summary of fix suggestions we have at the moment:
- Wrap all NumPy functions of the category described above on libraries that implement the
__array_function__ protocol
- Use a sentinel (e.g.,
None) as a fallback to NumPy function, similar to the NEP proposal
@shoyer @mrocklin
The discussion for this issue started in cupy/cupy#2029, please refer to it for all the details.
Currently, CuPy creates aliases from some NumPy C functions that use the
__array_function__dispatch. This causes an infinite loop since CuPy keeps on calling the NumPy function, and this dispatches the CuPy alias. Note that the same case may apply to any other libraries that implementation the__array_function__protocol.Summary of fix suggestions we have at the moment:
__array_function__protocolNone) as a fallback to NumPy function, similar to the NEP proposal@shoyer @mrocklin