-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Add paddle.utils.dlpack APIs #35067
Add paddle.utils.dlpack APIs #35067
Conversation
Thanks for your contribution! |
python/paddle/utils/dlpack.py
Outdated
[0.10000000, 0.20000000, 0.60000002, 0.69999999]]) | ||
""" | ||
|
||
if str(type(dlpack)) != "<class 'PyCapsule'>": |
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.
这块的写法需要正式化一下
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.
done
dltensor, and the data type is PyCapsule. | ||
|
||
Examples: | ||
.. code-block:: python |
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.
这里需要预览一下 看起来写法有问题
python/paddle/utils/dlpack.py
Outdated
# limitations under the License. | ||
|
||
import paddle | ||
from paddle.fluid.data_feeder import convert_dtype |
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.
和下面的import形式统一吧,from ..fluid.data_feeder import convert_dtype
# <capsule object "dltensor" at 0x7f6103c681b0> | ||
""" | ||
|
||
if in_dygraph_mode(): |
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.
这里有个因为,dlpack在cpu可以支持吗?
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.
在 CPU 版本的 paddlepaddle 版本上进行了测试,是支持的。
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.
LGTM
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.
LGTM
PR types
New features
PR changes
APIs
Describe
paddle.utils.dlpack.from_dlpack
andpaddle.utils.dlpack.to_dlpack
APIs.from_dlpack
C++ code.