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 dropout composite rule #50497

Merged
merged 3 commits into from
Feb 22, 2023

Conversation

cxxly
Copy link
Contributor

@cxxly cxxly commented Feb 14, 2023

PR types

New features

PR changes

Others

Describe

add dropout composite rule.

@paddle-bot
Copy link

paddle-bot bot commented Feb 14, 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.

@cxxly cxxly force-pushed the comp_dropout branch 5 times, most recently from 88cddc7 to 25c6a73 Compare February 16, 2023 03:09
add mean layer_norm dropout op map

add input map check

composite softmax support input shape []
@cxxly cxxly force-pushed the comp_dropout branch 4 times, most recently from 33655b5 to 1990044 Compare February 20, 2023 02:46
@@ -20,6 +20,8 @@
import functools
import operator

import paddle
Copy link
Contributor

Choose a reason for hiding this comment

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

尽量不要在这里直接引入paddle,防止出现引用循环依赖

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

input_, p, training=(not is_test), mode=mode
)
if core._is_fwd_prim_enabled():
paddle.incubate.autograd.to_prim(mp.blocks)
Copy link
Contributor

Choose a reason for hiding this comment

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

补充op check,确认dropout算子被拆解

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

exe.run(sp)
return exe.run(mp, feed={input_.name: x}, fetch_list=[output, grad])

core._set_prim_forward_enabled(True)
Copy link
Contributor

Choose a reason for hiding this comment

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

补充前反向都拆的case

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



@REGISTER_COMPOSITE('dropout')
def dropout_composite(x, seed_tensor, p, is_test, mode, seed, fix_seed):
Copy link
Contributor

Choose a reason for hiding this comment

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

The function signature should be consistent with dropout 2.x API

Copy link
Contributor Author

Choose a reason for hiding this comment

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

当前2.0API与legacy_ops.yaml定义中不一致,前向拆分是从op拆分到更细粒度op,所以签名暂无法与2.0API保持一致。后续legacy_ops迁移后,该部分会统一迁移

Copy link
Contributor

Choose a reason for hiding this comment

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

understand

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

@Charles-hit Charles-hit merged commit 1be2cbe into PaddlePaddle:develop Feb 22, 2023
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.

4 participants