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

tanh_double_grad_rules #52192

Merged

Conversation

xiaoguoguo626807
Copy link
Contributor

PR types

others

PR changes

others

Describe

Pcard-66975
拆解tanh_double_grad

@paddle-bot
Copy link

paddle-bot bot commented Mar 27, 2023

你的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.

JiabinYang
JiabinYang previously approved these changes Mar 28, 2023
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

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.

some commments

// tanh grad grad : ddout = (1 - out^2) * ddx, dout = - (dout_old * 2 * out *
// ddx)
if (out_grad) {
auto out_grad_tmp = -1 * grad_out * 2 * out * grad_x_grad;
Copy link
Contributor

Choose a reason for hiding this comment

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

optimize this logic using tmp var

Copy link
Contributor

Choose a reason for hiding this comment

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

one comment

}

if (grad_out_grad) {
auto grad_out_grad_tmp = (1 - out * out) * grad_x_grad;
Copy link
Contributor

Choose a reason for hiding this comment

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

like 137

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

@xiaoguoguo626807 xiaoguoguo626807 merged commit d966301 into PaddlePaddle:develop Mar 29, 2023
@xiaoguoguo626807 xiaoguoguo626807 deleted the tanh_doublegrad branch June 12, 2024 02:26
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