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

Add paddle.utils.dlpack APIs #35067

Merged
merged 10 commits into from
Aug 26, 2021
Merged

Add paddle.utils.dlpack APIs #35067

merged 10 commits into from
Aug 26, 2021

Conversation

DesmonDay
Copy link
Contributor

@DesmonDay DesmonDay commented Aug 23, 2021

PR types

New features

PR changes

APIs

Describe

  1. Add paddle.utils.dlpack.from_dlpack and paddle.utils.dlpack.to_dlpack APIs.
  2. Fix a small bug in from_dlpack C++ code.
    image
    image

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

[0.10000000, 0.20000000, 0.60000002, 0.69999999]])
"""

if str(type(dlpack)) != "<class 'PyCapsule'>":
Copy link
Contributor

Choose a reason for hiding this comment

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

这块的写法需要正式化一下

Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

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

这里需要预览一下 看起来写法有问题

# limitations under the License.

import paddle
from paddle.fluid.data_feeder import convert_dtype
Copy link
Contributor

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():
Copy link
Contributor

Choose a reason for hiding this comment

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

这里有个因为,dlpack在cpu可以支持吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

在 CPU 版本的 paddlepaddle 版本上进行了测试,是支持的。

Superjomn
Superjomn previously approved these changes Aug 26, 2021
Copy link
Contributor

@Superjomn Superjomn left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@wawltor wawltor left a comment

Choose a reason for hiding this comment

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

LGTM

@wawltor wawltor merged commit 8dc050d into PaddlePaddle:develop Aug 26, 2021
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.

3 participants