Skip to content

Support dropout backward in eval mode#35122

Merged
guoshengCS merged 4 commits intoPaddlePaddle:developfrom
smallv0221:yxp0824
Aug 26, 2021
Merged

Support dropout backward in eval mode#35122
guoshengCS merged 4 commits intoPaddlePaddle:developfrom
smallv0221:yxp0824

Conversation

@smallv0221
Copy link
Contributor

PR types

Bug fixes

PR changes

APIs

Describe

Support dropout backward in eval mode

@paddle-bot-old
Copy link

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

if (platform::is_gpu_place(context.GetPlace()) && vec_size == 4 &&
size % 4 == 0) {
if (context.Attr<bool>("is_test") == true) {
dX.device(place) = static_cast<T>(0) * dY;
Copy link
Contributor

Choose a reason for hiding this comment

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

这里是1乘吧。另外is_test==true时应该也要分是否"upscale_in_train"来处理下。

guoshengCS
guoshengCS previously approved these changes Aug 26, 2021
if (platform::is_gpu_place(context.GetPlace()) && vec_size == 4 &&
size % 4 == 0) {
float dropout_prob = context.Attr<float>("dropout_prob");
dX.device(place) = dY / static_cast<T>(1.0f - dropout_prob);
Copy link
Contributor

Choose a reason for hiding this comment

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

这里应该是dY * static_cast<T>(1.0f - dropout_prob);

@guoshengCS guoshengCS merged commit f1275fb 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.

2 participants