8000 DLPack support for NumPy · Issue #19013 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
DLPack support for NumPy #19013
Closed
Closed
@hameerabbasi

Description

@hameerabbasi

Feature

Motivation

Currently, any library which needs to exchange data with NumPy needs to have it as a dependency. This issue will allow moving away from that approach to a more Pythonic standards-based approach leveraging the DLPack Library, as described in the Array API standard. This is also mentioned in and a prerequisite for NEP 47, although it can be discussed and integrated independently of it as well, the only caveat being that if the NEP is accepted; adopting DLPack is a given.

DLPack is a small C header-only library with a stable ABI.

Changes needed to NumPy

The numpy.ndarray type will need to gain two new methods:

And the NumPy namespace will gain one extra function:

  • from_dlpack: This will consume a PyCapsule containing a DLPack struct and create a numpy.ndarray based on that. It will raise a RuntimeError on all unsupported configurations of the object.

Relevant issues/discussion:

Edit: Previously this issue said from_dlpack was a method, that has been corrected.

cc @rgommers @mattip

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

      0