-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
88cddc7
to
25c6a73
Compare
add mean layer_norm dropout op map add input map check composite softmax support input shape []
33655b5
to
1990044
Compare
@@ -20,6 +20,8 @@ | |||
import functools | |||
import operator | |||
|
|||
import paddle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
尽量不要在这里直接引入paddle,防止出现引用循环依赖
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
补充op check,确认dropout算子被拆解
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
补充前反向都拆的case
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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迁移后,该部分会统一迁移
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
understand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR types
New features
PR changes
Others
Describe
add dropout composite rule.