-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 pool2d cudnn op #4636
Add pool2d cudnn op #4636
Conversation
75a2f0f
to
104ca74
Compare
846e479
to
8c51a0d
Compare
92b75fd
to
91caf62
Compare
80f8bf7
to
4b82b2f
Compare
e5d7580
to
926b90f
Compare
0b12868
to
74abe6b
Compare
74abe6b
to
a4274d3
Compare
28b534c
to
8149e6d
Compare
4e7c1de
to
2d7d43f
Compare
1c7f783
to
7f34029
Compare
paddle/operators/pool_op.cc
Outdated
@@ -80,34 +80,31 @@ Pool2dOpMaker::Pool2dOpMaker(framework::OpProto *proto, | |||
"the number of channels, H and W is the height and " | |||
"width of feature."); | |||
|
|||
AddAttr<std::string>("pooling_type", | |||
"Pooling_type of pooling operator." | |||
AddAttr<std::string>("poolingType", |
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.
Google C++ style did not specify the constant string naming rules, but since this attribute is going to be used when user define operators using python, following python style seems resonable?
paddle/operators/pool_op.cc
Outdated
AddAttr<std::string>("pooling_type", | ||
"Pooling_type of pooling operator." | ||
AddAttr<std::string>("poolingType", | ||
"(string), poolingType of pooling operator." |
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.
(string), pooling type, can be "max" for max-pooling and "avg" for average-pooling.
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
"The pooling window size(height, width) of pooling operator." | ||
"If global_pooling = true, ksize is ignored and need not be " | ||
"(vector ), the pooling window size(height, width) of pooling operator." | ||
"If globalPooling = true, ksize is ignored and need not be " |
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.
Remove "and need not be specified".
Ignored means whether a user is providing this value, it's not used.
"need not be specified" means the user should never provide this value, or else it will cause error.
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
AddAttr<std::vector<int>>( | ||
"ksize", | ||
"The pooling window size(depth, height, width) of pooling operator." | ||
"If global_pooling = true, ksize is ignored and need not be " | ||
"(vector ), the pooling window size(depth, height, width) of pooling " |
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.
Pooling 3d and 2d seem to have very similar description documents, They can be merged into one OpMaker
using the same description, like:
(vector), the pooling window size of pooling operator, for 3d pooling the layout should be (depth, height, width), for 2d it should be (height, width). ...
paddle/operators/pool_cudnn_op.cu
Outdated
using PoolingMode = platform::PoolingMode; | ||
|
||
// NOTE: copy from conv_cudnn | ||
std::vector<int> Dims2VectorPool(const framework::DDim &dims) { |
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.
You can put this function to ddim.cc
.
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
|
||
namespace paddle { | ||
namespace operators {} // namespace operators | ||
} // namespace 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.
Can remove this file and move #include
to pool_cudnn_op.cu
.
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.
Currently, this header file is necessary to register as two op (pool2d_cudnn, pool2d_cudnn).
We can talk abort this in next PR.
The change of attr name causes CI error:
|
7f34029
to
df48b43
Compare
9582e85
to
cadee84
Compare
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++
fix #4637
Add pool cudnn op.