Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DLPACK] Support the new python array api with DLPack #7993

Merged
merged 2 commits into from
May 7, 2021

Conversation

YuchenJin
Copy link
Contributor

Adopt the new Python array API standard with DLPack:

  • Add __dlpack__(self, stream=None) and __dlpack_device__(self) methods on tvm.nd.NDArray. Note that tvm operates on the legacy default stream by default, so no explicit synchronization is needed.
  • tvm.nd.from_dlpack can take a tensor-like object with __dlpack__ method, or a DLPack capsule.

More contexts:

@YuchenJin
Copy link
Contributor Author

cc @tqchen @junrushao1994

Copy link
Member

@junrushao junrushao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Yuchen for the contribution! Overall it looks good to me. Please fix the lint issues

@YuchenJin
Copy link
Contributor Author

YuchenJin commented May 6, 2021

Thanks, @junrushao1994! :)

@YuchenJin YuchenJin closed this May 6, 2021
@YuchenJin YuchenJin reopened this May 6, 2021
@junrushao junrushao merged commit 8d9a1df into apache:main May 7, 2021
@junrushao
Copy link
Member

Thanks @YuchenJin! It is now merged!

@YuchenJin YuchenJin deleted the support-new-dlpack-array-api branch May 7, 2021 22:27
mehrdadh pushed a commit to mehrdadh/tvm that referenced this pull request May 19, 2021
* [DLPACK] Support the new python array api with dlpack

* Fix lint
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Jun 17, 2021
* [DLPACK] Support the new python array api with dlpack

* Fix lint
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Jun 17, 2021
* [DLPACK] Support the new python array api with dlpack

* Fix lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants