-
Notifications
You must be signed in to change notification settings - Fork 6k
【SCU】【Paddle Tensor No.3】新增 Tensor.__dlpack__
#69689
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
Changes from 29 commits
15399e4
8986f04
17bbaeb
773e954
09fe571
d20ae97
18349c5
34d57d5
2461584
72fc12d
6d4addc
eeb07ec
48e14ac
ae0a24b
82c622c
73bb823
cf81a6d
376e452
777324f
43a4d5c
214b64c
b1a12a2
3bb3cdd
c99d929
a456dbe
fddc3c2
c8e6a5f
024397d
9348366
a79bad9
0b65ceb
6976b37
4e6dc05
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -591,6 +591,7 @@ | |
| from .utils.dlpack import ( | ||
| from_dlpack, | ||
| to_dlpack, | ||
| __dlpack__, | ||
| ) | ||
|
|
||
| # CINN has to set a flag to include a lib | ||
|
|
@@ -1212,6 +1213,7 @@ | |
| 'positive', | ||
| 'from_dlpack', | ||
| 'to_dlpack', | ||
| '__dlpack__', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. __dlpack__是Tensor的方法,不是paddle模块下的函数 |
||
| 'inf', | ||
| 'newaxis', | ||
| 'nan', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -301,6 +301,7 @@ class AbstractTensor: | |
| def _grad_ivar(self) -> Tensor | None: ... | ||
|
|
||
| # annotation: ${tensor_alias} | ||
| def __dlpack__(self) -> Any: ... | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个返回的是Any吗?应该是CapsuleType,参考 |
||
|
|
||
| class Tensor(AbstractTensor, AbstractEagerParamBase): | ||
| # annotation: ${tensor_docstring} | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不应该改动这个文件 |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不需要改pybind
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个submodule不要修改
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个文件记得还原回去 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个复用 paddle.to_dlpack即可,不用写C++代码,可以参考:https://github.com/pytorch/pytorch/blob/main/torch/_tensor.py#L1565
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的谢谢老师