Skip to content

Commit 64e3356

Browse files
committed
fix pool3d doc.
test=release/1.3
1 parent 324e73f commit 64e3356

File tree

2 files changed

+34
-13
lines changed

2 files changed

+34
-13
lines changed

paddle/fluid/operators/pool_op.cc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,10 @@ void Pool2dOpMaker::Make() {
168168
"be ignored."); // TODO(Chengduo): Add checker.
169169
// (Currently,
170170
// TypedAttrChecker don't support vector type.)
171-
AddAttr<bool>("global_pooling",
172-
"(bool, default false) Whether to use the global pooling. "
173-
"If global_pooling = true, ksize and paddings will be ignored.")
171+
AddAttr<bool>(
172+
"global_pooling",
173+
"(bool, default false) Whether to use the global pooling. "
174+
"If global_pooling = true, kernel size and paddings will be ignored.")
174175
.SetDefault(false);
175176
AddAttr<std::vector<int>>("strides",
176177
"(vector<int>, default {1, 1}), strides(height, "
@@ -182,7 +183,7 @@ void Pool2dOpMaker::Make() {
182183
"paddings",
183184
"(vector<int>, default {0,0}), paddings(height, width) of pooling "
184185
"operator."
185-
"If global_pooling = true, paddings and ksize will be ignored.")
186+
"If global_pooling = true, paddings and kernel size will be ignored.")
186187
.SetDefault({0, 0});
187188
AddAttr<bool>(
188189
"exclusive",
@@ -204,7 +205,7 @@ void Pool2dOpMaker::Make() {
204205
.SetDefault(false);
205206
AddAttr<bool>(
206207
"ceil_mode",
207-
"(bool, default false) Wether to use the ceil function to calculate "
208+
"(bool, default false) Whether to use the ceil function to calculate "
208209
"output height and width. False is the default. If it is set to False, "
209210
"the floor function will be used.")
210211
.SetDefault(false);
@@ -333,7 +334,7 @@ void Pool3dOpMaker::Make() {
333334
AddAttr<bool>(
334335
"global_pooling",
335336
"(bool, default false) Whether to use the global pooling. "
336-
"If global_pooling = true, ksize and paddings wille be ignored.")
337+
"If global_pooling = true, kernel size and paddings will be ignored.")
337338
.SetDefault(false);
338339
AddAttr<std::vector<int>>(
339340
"strides",
@@ -368,7 +369,7 @@ void Pool3dOpMaker::Make() {
368369
.SetDefault(false);
369370
AddAttr<bool>(
370371
"ceil_mode",
371-
"(bool, default false) Wether to use the ceil function to calculate "
372+
"(bool, default false) Whether to use the ceil function to calculate "
372373
"output height and width. False is the default. If it is set to False, "
373374
"the floor function will be used.")
374375
.SetDefault(false);

python/paddle/fluid/layers/nn.py

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2441,7 +2441,7 @@ def pool2d(input,
24412441
24422442
data = fluid.layers.data(
24432443
name='data', shape=[3, 32, 32], dtype='float32')
2444-
conv2d = fluid.layers.pool2d(
2444+
pool2d = fluid.layers.pool2d(
24452445
input=data,
24462446
pool_size=2,
24472447
pool_type='max',
@@ -2490,6 +2490,7 @@ def pool2d(input,
24902490
return pool_out
24912491

24922492

2493+
@templatedoc()
24932494
def pool3d(input,
24942495
pool_size=-1,
24952496
pool_type="max",
@@ -2501,13 +2502,19 @@ def pool3d(input,
25012502
name=None,
25022503
exclusive=True):
25032504
"""
2504-
This function adds the operator for pooling in 3-dimensions, using the
2505-
pooling configurations mentioned in input parameters.
2505+
${comment}
25062506
25072507
Args:
2508-
input (Variable): ${input_comment}
2509-
pool_size (int): ${ksize_comment}
2510-
pool_type (str): ${pooling_type_comment}
2508+
input (Variable): The input tensor of pooling operator. The format of
2509+
input tensor is NCDHW, where N is batch size, C is
2510+
the number of channels, D is the depth of the feature,
2511+
H is the height of the feature, and W is the width
2512+
of the feature.
2513+
pool_size (int|list|tuple): The pool kernel size. If pool kernel size
2514+
is a tuple or list, it must contain three integers,
2515+
(pool_size_Depth, pool_size_Height, pool_size_Width).
2516+
Otherwise, the pool kernel size will be the cube of an int.
2517+
pool_type (string): ${pooling_type_comment}
25112518
pool_stride (int): stride of the pooling layer.
25122519
pool_padding (int): padding size.
25132520
global_pooling (bool): ${global_pooling_comment}
@@ -2520,6 +2527,19 @@ def pool3d(input,
25202527
25212528
Returns:
25222529
Variable: output of pool3d layer.
2530+
2531+
Examples:
2532+
2533+
.. code-block:: python
2534+
2535+
data = fluid.layers.data(
2536+
name='data', shape=[3, 32, 32, 32], dtype='float32')
2537+
pool3d = fluid.layers.pool3d(
2538+
input=data,
2539+
pool_size=2,
2540+
pool_type='max',
2541+
pool_stride=1,
2542+
global_pooling=False)
25232543
"""
25242544
if pool_type not in ["max", "avg"]:
25252545
raise ValueError(

0 commit comments

Comments
 (0)