Skip to content

NEP-18: Handling aliased NumPy functions #12974

Open
@pentschev

Description

@pentschev

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions