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

【prim】add forward output for Silu grad signature #53632

Merged
merged 9 commits into from
May 12, 2023

Conversation

xiaoguoguo626807
Copy link
Contributor

PR types

Bug fixes

PR changes

others

Description

pcard-66975
修改silu_grad的yaml配置为silu_grad(x, out, out_grad, x_grad), 增加前向的输出为输入,以避免一阶组合算子在计算sigmod后进行自动微分,使得数值不稳定。

@paddle-bot
Copy link

paddle-bot bot commented May 9, 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.

@paddle-bot
Copy link

paddle-bot bot commented May 9, 2023

❌ The PR is not created using PR's template. You can refer to this Demo.
Please use PR's template, it helps save our maintainers' time so that more developers get helped.

@xiaoguoguo626807 xiaoguoguo626807 changed the title Silu grad 【prim】add forward output for Silu grad signature May 11, 2023
Comment on lines 31 to 37
#define DECLARE_ACTIVATION_GRAD_KERNEL_DEPXOUT(name) \
template <typename T, typename Context> \
void name##GradKernel(const Context& dev_ctx, \
const DenseTensor& x, \
const DenseTensor& out, \
const DenseTensor& dout, \
DenseTensor* dx);
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

@@ -32,6 +32,18 @@ namespace phi {
dev_ctx, &x, nullptr, &dout, dx, functor); \
}

#define DEFINE_CPU_ACTIVATION_GRAD_KERNEL_DEPXOUT(name, functor_class) \
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

@@ -86,6 +86,18 @@ void ActivationGradGPUImpl(const Context& dev_ctx,
dev_ctx, &x, nullptr, &dout, dx, functor); \
}

#define DEFINE_GPU_ACTIVATION_GRAD_KERNEL_DEPXOUT(name, functor_class) \
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

@@ -49,6 +49,18 @@ void ActivationGradXPUImpl(const Context& dev_ctx,
dev_ctx, &x, nullptr, &dout, dx, functor); \
}

#define DEFINE_XPU_ACTIVATION_GRAD_KERNEL_DEPXOUT(name, functor_class) \
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

Copy link
Contributor

@cxxly cxxly 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 3846111 into PaddlePaddle:develop May 12, 2023
@xiaoguoguo626807 xiaoguoguo626807 deleted the silu_grad branch June 12, 2024 02:27
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