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

[Pass] Add keepdims convert pass for OpenCL #8319

Merged
merged 13 commits into from
Jan 27, 2022

Conversation

zhaoyang-star
Copy link
Collaborator

@zhaoyang-star zhaoyang-star commented Jan 21, 2022

KeepdimsConvertPass splits some ops whose attribute keepdims or keep_dim is false to two ops.
The reason for adding this pass is that it is hard for gpu to do reshape opterations in arg_max/reduce_mean, etc,. So we split this problem.

 * For example:
 *        |
 *       var1
 *        v
 *   OP: arg_max(keepdims=false)
 *        |
 *       var2
 *        v
 *
 * After this pass is applied:
 *        |
 *       var1
 *        v
 *   OP: arg_max(keepdims=true)
 *        |
 *    var2/trans
 *        v
 *   OP: reshape(shape = original arg_max's output dims)
 *        |
 *       var2
 *        v
 * 

原始模型部分截图:
image
应用本 Pass 后:
image

已在 text_intention_v1 模型中验证精度正确。

@paddle-bot-old
Copy link

Thanks for your contribution!

daming5432
daming5432 previously approved these changes Jan 21, 2022
Copy link
Collaborator

@daming5432 daming5432 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
Collaborator

@zhenlin-work zhenlin-work left a comment

Choose a reason for hiding this comment

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

LGTM

@zhaoyang-star zhaoyang-star merged commit 47a0485 into PaddlePaddle:develop Jan 27, 2022
@zhaoyang-star zhaoyang-star deleted the keepdims_pass branch January 27, 2022 01:58
WeiLi233 pushed a commit to WeiLi233/Paddle-Lite that referenced this pull request Mar 29, 2022
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.

None yet

3 participants