@@ -29,15 +29,15 @@ void PoolOp::InferShape(framework::InferShapeContext *ctx) const {
2929
3030 auto in_x_dims = ctx->GetInputDim (" X" );
3131
32- std::string pooling_type = ctx->Attrs ().Get <std::string>(" poolingType " );
32+ std::string pooling_type = ctx->Attrs ().Get <std::string>(" pooling_type " );
3333 std::vector<int > ksize = ctx->Attrs ().Get <std::vector<int >>(" ksize" );
3434 std::vector<int > strides = ctx->Attrs ().Get <std::vector<int >>(" strides" );
3535 std::vector<int > paddings = ctx->Attrs ().Get <std::vector<int >>(" paddings" );
3636
3737 PADDLE_ENFORCE (in_x_dims.size () == 4 || in_x_dims.size () == 5 ,
3838 " Pooling intput should be 4-D or 5-D tensor." );
3939
40- if (ctx->Attrs ().Get <bool >(" globalPooling " )) {
40+ if (ctx->Attrs ().Get <bool >(" global_pooling " )) {
4141 ksize.resize (static_cast <size_t >(in_x_dims.size ()) - 2 );
4242 for (size_t i = 0 ; i < ksize.size (); ++i) {
4343 paddings[i] = 0 ;
@@ -83,20 +83,20 @@ Pool2dOpMaker::Pool2dOpMaker(framework::OpProto *proto,
8383 " H is the height of the feature, "
8484 " and W is the width of the feature." );
8585
86- AddAttr<std::string>(" poolingType " ,
86+ AddAttr<std::string>(" pooling_type " ,
8787 " (string), pooling type, can be \" max\" for max-pooling "
8888 " and \" avg\" for average-pooling." )
8989 .InEnum ({" max" , " avg" });
9090 AddAttr<std::vector<int >>(" ksize" ,
9191 " (vector<int>) The pooling window "
9292 " size(height, width) of the pooling operator. "
93- " If globalPooling = true, ksize and paddings will "
93+ " If global_pooling = true, ksize and paddings will "
9494 " be ignored." ); // TODO(Chengduo): Add checker.
9595 // (Currently,
9696 // TypedAttrChecker don't support vector type.)
97- AddAttr<bool >(" globalPooling " ,
97+ AddAttr<bool >(" global_pooling " ,
9898 " (bool, default false) Whether to use the global pooling. "
99- " If globalPooling = true, ksize and paddings will be ignored." )
99+ " If global_pooling = true, ksize and paddings will be ignored." )
100100 .SetDefault (false );
101101 AddAttr<std::vector<int >>(" strides" ,
102102 " (vector<int>, default {1, 1}), strides(height, "
@@ -107,15 +107,15 @@ Pool2dOpMaker::Pool2dOpMaker(framework::OpProto *proto,
107107 " paddings" ,
108108 " (vector<int>, defalut {0,0}), paddings(height, width) of pooling "
109109 " operator."
110- " If globalPooling = true, paddings and ksize will be ignored." )
110+ " If global_pooling = true, paddings and ksize will be ignored." )
111111 .SetDefault ({0 , 0 }); // TODO(Chengduo): Add checker. (Currently,
112112 // TypedAttrChecker don't support vector type.)
113113
114114 AddComment (R"DOC(
115115Pool2d Operator.
116116
117117The pooling2d operation calculates the output based on
118- the input, poolingType and ksize, strides, paddings parameters.
118+ the input, pooling_type and ksize, strides, paddings parameters.
119119Input(X) and output(Out) are in NCHW format, where N is batch size, C is the
120120number of channels, H is the height of the feature, and W is the width of the feature.
121121Parameters(ksize, strides, paddings) are two elements.
@@ -152,21 +152,22 @@ Pool3dOpMaker::Pool3dOpMaker(framework::OpProto *proto,
152152 " the number of channels, and D, H and W is the depth, height and "
153153 " width of the feature, respectively." );
154154
155- AddAttr<std::string>(" poolingType " ,
155+ AddAttr<std::string>(" pooling_type " ,
156156 " (string) Pooling type, can be \" max\" for max-pooling "
157157 " and \" avg\" for average-pooling." )
158158 .InEnum ({" max" , " avg" });
159159 AddAttr<std::vector<int >>(
160160 " ksize" ,
161161 " (vector<int>) The pooling window size(depth, height, "
162162 " width) of pooling operator. "
163- " If globalPooling = true, ksize and paddings will "
163+ " If global_pooling = true, ksize and paddings will "
164164 " be ignored." ); // TODO(Chengduo): Add checker.
165165 // (Currently,
166166 // TypedAttrChecker don't support vector type.)
167- AddAttr<bool >(" globalPooling" ,
168- " (bool, default false) Whether to use the global pooling. "
169- " If globalPooling = true, ksize and paddings wille be ignored." )
167+ AddAttr<bool >(
168+ " global_pooling" ,
169+ " (bool, default false) Whether to use the global pooling. "
170+ " If global_pooling = true, ksize and paddings wille be ignored." )
170171 .SetDefault (false );
171172 AddAttr<std::vector<int >>(
172173 " strides" ,
@@ -178,15 +179,15 @@ Pool3dOpMaker::Pool3dOpMaker(framework::OpProto *proto,
178179 " paddings" ,
179180 " (vector<int>, defalut {0,0,0}), paddings(depth, height, "
180181 " width) of pooling operator. "
181- " If globalPooling = true, ksize and paddings will be ignored." )
182+ " If global_pooling = true, ksize and paddings will be ignored." )
182183 .SetDefault ({0 , 0 , 0 }); // TODO(Chengduo): Add checker. (Currently,
183184 // TypedAttrChecker don't support vector type.)
184185
185186 AddComment (R"DOC(
186187Pool3d Operator.
187188
188189The pooling3d operation calculates the output based on
189- the input, poolingType , ksize, strides, and paddings parameters.
190+ the input, pooling_type , ksize, strides, and paddings parameters.
190191Input(X) and output(Out) are in NCDHW format, where N is batch
191192size, C is the number of channels, and D, H and W are the depth, height and
192193width of the feature, respectively. Parameters(ksize, strides, paddings)
0 commit comments