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

【Hackathon No.7】为 Paddle 新增 apply API rfcs #761

Merged
merged 3 commits into from
Dec 15, 2023

Conversation

yangguohao
Copy link
Contributor

@yangguohao yangguohao commented Nov 26, 2023

No description provided.

Copy link

paddle-bot bot commented Nov 26, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请检查PR提交格式和内容是否完备,具体请参考示例模版
Your PR has been submitted. Thanks for your contribution!
Please check its format and content. For this, you can refer to Template and Demo.

@jeff41404
Copy link
Contributor

此实现方案当前只能在CPU上运行,是否应该支持GPU运行,以及如何支持需要论证

@jeff41404
Copy link
Contributor

按照API实现规范,要同时支持动态图和静态图,在静态图如何实现,也需要说明

@yangguohao
Copy link
Contributor Author

@luotao1 @jeff41404 老师您好,我已经尝试添加了对于新旧 ir 静态图的支持,麻烦再review下吧。

)
self._apply_(func)

@framework.dygraph_only
Copy link
Contributor

@jeff41404 jeff41404 Dec 14, 2023

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 删除该装饰器。

return self._apply(func)
```

C++ 端则是在 eager_method.cc 中增加相应的逻辑,可以复用 PyTensorHook 来对 tensor 作用 callable python function。
Copy link
Contributor

Choose a reason for hiding this comment

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

如果Tensor在CPU上,这样做是可以的;但如果Tensor在GPU上,这样实现是否能运行,需要说明

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 新增加说明。

Copy link
Contributor

@jeff41404 jeff41404 left a comment

Choose a reason for hiding this comment

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

LGTM

@jeff41404 jeff41404 merged commit c7312bd into PaddlePaddle:master Dec 15, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants