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

[Custom Extension] Fix custom double_grad backward=None #49224

Merged

Conversation

jiahy0825
Copy link
Contributor

@jiahy0825 jiahy0825 commented Dec 21, 2022

PR types

Bug fixes

PR changes

Others

Describe

Pre-PR fixes custom op bug of backward: [Custom operator] Fix custom operator backward=None bug #48656
This PR fixes custom op bug of double backward, follows the same idea of pre-PR.

Other change:

  • Fix test case of double_grad_dynamic, original test case cannot test eager mode.
  • Fix bug: custom cuda double_grad kernel bug

本 PR 修复了自定义算子二阶反向的 bug,遵循 [Custom operator] Fix custom operator backward=None bug #48656 相同的思路(前置 PR 修复了一阶反向的 bug)

其他改动

  • 修复了 double_grad_dynamic 测试用例,原来的单测无法访问到新动态图下的二阶反向 op
  • 修复了自定义 cuda 二阶反向 kernel 的 bug

@paddle-bot
Copy link

paddle-bot bot commented Dec 21, 2022

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Copy link
Contributor

@JiabinYang JiabinYang left a comment

Choose a reason for hiding this comment

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

one comment

@@ -153,7 +153,8 @@ def custom_relu_double_grad_dynamic(func, device, dtype, np_x, use_func=True):
dx = paddle.grad(
outputs=[out], inputs=[t], create_graph=True, retain_graph=True
)

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.

Maybe fix this test, since this test doesn't test double grad in the right way

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Already fix this, please review it again, thanks~

Copy link
Contributor

@JiabinYang JiabinYang left a comment

Choose a reason for hiding this comment

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

LGTM

@jiahy0825 jiahy0825 merged commit ca4155c into PaddlePaddle:develop Dec 23, 2022
jiahy0825 added a commit to jiahy0825/Paddle that referenced this pull request Dec 23, 2022
…#49224)

* fix custom double_grad backward=None

* fix custom_relu.cu bug && polish testcase of double_grad

* remove old dynamic graph test
phlrain pushed a commit that referenced this pull request Dec 27, 2022
* [Release2.4] Revert python link prs (#48573)

* Revert "Fix mac link python (#48017)"

This reverts commit 3fa7a73.

* Revert "[Cherry-pick] Fix python link error (#47811)"

This reverts commit ff642c6.

* Update config.go

* fix custom operator backward=None (#48656)

* [Custom Extension] Fix custom double_grad backward=None (#49224)

* fix custom double_grad backward=None

* fix custom_relu.cu bug && polish testcase of double_grad

* remove old dynamic graph test

* add import fluid

* add import fluid

Co-authored-by: Chen Weihang <chenweihang@baidu.com>
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.

None yet

2 participants