Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Should cp.ndarray.__getitem__(some_object) check to see if some_object implements __cuda_array_interface__ or DLPack? #8352

@jpivarski

Description

@jpivarski

Description

Currently, if you do

cupy_array[some_iterable]

CuPy will interrogate some_iterable to see if it implements __array_struct__, __array_interface__, __array__ (in that order) before concluding that some_iterable is not an array and proceed to iterate over it as a Python object.

The Interoperability documentation says that CuPy produces (for Numba) and consumes (from PyTorch) the __cuda_array_interface__ protocol, as well as DLPack. But if some_iterable produces either or both of these protocols, CuPy does not check.

Should it? Is this a feature request or a bug report?

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    cat:enhancementImprovements to existing featuresprio:highto-be-backportedPull-requests to be backported to stable branch

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions