Skip to content

NEP-18: fix() with CuPy array depends on __array_wrap__ #4496

Closed

Description

@pentschev

Calling dask.array.fix() on a Dask array created from a CuPy array fails as it depends on unimplemented __array_wrap__ from CuPy. There's an issue open to add that feature to CuPy cupy/cupy#589.

@mrocklin

Activity

  1. jakirkham commented on Mar 6, 2019

    @jakirkham
    Member

    FWIW raised issue ( numpy/numpy#13100 ) to see if fix and a few other functions could be converted to ufuncs, which would be one way to solve this. Please feel free to join the discussion over there if it is of interest.

  2. pentschev commented on Mar 6, 2019

    @pentschev
    MemberAuthor

    Thanks @jakirkham, I've subscribed for notifications, I'll join if I can help with something. :)

  3. jakirkham commented on Mar 18, 2019

    @jakirkham
    Member

    Just in case it is needed, here's a workaround.

    np.where(a < 0, np.ceil(a), np.floor(a))

    CuPy does implement where, which could be dispatched to via NEP 18. Also ceil and floor are both ufuncs, which already dispatch through the __array_ufunc__ protocol.

  4. pentschev commented on May 21, 2019

    @pentschev
    MemberAuthor

    Closing this, since #4708 was merged already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions