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

Add Sparse OP Maxpool #40569

Merged
merged 56 commits into from
Mar 18, 2022
Merged

Add Sparse OP Maxpool #40569

merged 56 commits into from
Mar 18, 2022

Conversation

zkh2016
Copy link
Contributor

@zkh2016 zkh2016 commented Mar 15, 2022

PR types

New features

PR changes

OPs

Describe

新增Sparse算子:MaxPool,同样采用预先生成输入输出映射表rulebook来进行max pool的计算,rulebook的生成参考PR,需要调用ProductRuleBook,依赖PR

@paddle-bot-old
Copy link

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

@zkh2016 zkh2016 changed the title Sparse Maxpool Add Sparse OP Maxpool Mar 17, 2022
for (int i = 0; i < kernel_size; i++) {
if (counter[i] <= 0) {
continue;
}
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

dev_ctx.stream());
dev_ctx.Wait();
for (int i = 0; i < rulebook_len; i++) {
counter[h_counter[i]] += 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

h_counter 建议改下名称

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok,下一个PR改。

#include "paddle/phi/kernels/funcs/pooling.h"
#include "paddle/phi/kernels/funcs/sparse/convolution.h"

#include "paddle/phi/kernels/sparse/sparse_pool_grad_kernel.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

kernel头文件在最前面

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的,我后面PR里再调整

#include "paddle/phi/kernels/funcs/pooling.h"
#include "paddle/phi/kernels/funcs/sparse/convolution.h"
#include "paddle/phi/kernels/sparse/gpu/convolution.cu.h"
#include "paddle/phi/kernels/sparse/sparse_pool_kernel.h"
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

@chenwhql chenwhql left a comment

Choose a reason for hiding this comment

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

LGTM overall,细节问题可以后续再完善下

@zkh2016 zkh2016 changed the title Add Sparse OP Maxpool Add Sparse OP Maxpool Mar 18, 2022
@zkh2016 zkh2016 merged commit e52ffb7 into PaddlePaddle:develop Mar 18, 2022
@zkh2016 zkh2016 deleted the maxpool branch March 28, 2022 09:32
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