|
|
|
@ -2306,7 +2306,7 @@ def pool3d(input,
|
|
|
|
|
return pool_out
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@deprecated(since="2.0.0", update_to="paddle.nn.functional.adaptive_pool2d")
|
|
|
|
|
@deprecated(since="2.0.0")
|
|
|
|
|
@templatedoc(op_type="pool2d")
|
|
|
|
|
def adaptive_pool2d(input,
|
|
|
|
|
pool_size,
|
|
|
|
@ -2314,9 +2314,6 @@ def adaptive_pool2d(input,
|
|
|
|
|
require_index=False,
|
|
|
|
|
name=None):
|
|
|
|
|
"""
|
|
|
|
|
:alias_main: paddle.nn.functional.adaptive_pool2d
|
|
|
|
|
:alias: paddle.nn.functional.adaptive_pool2d,paddle.nn.functional.pooling.adaptive_pool2d
|
|
|
|
|
:old_api: paddle.fluid.layers.adaptive_pool2d
|
|
|
|
|
|
|
|
|
|
This operation calculates the output based on the input, pool_size,
|
|
|
|
|
pool_type parameters. Input(X) and output(Out) are in NCHW format, where N is batch
|
|
|
|
@ -2340,7 +2337,7 @@ def adaptive_pool2d(input,
|
|
|
|
|
Output(i ,j) &= \\frac{sum(Input[hstart:hend, wstart:wend])}{(hend - hstart) * (wend - wstart)}
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
input (Variable): The input tensor of pooling operator, which is a 4-D tensor
|
|
|
|
|
input (Tensor): The input tensor of pooling operator, which is a 4-D tensor
|
|
|
|
|
with shape [N, C, H, W]. The format of input tensor is NCHW,
|
|
|
|
|
where N is batch size, C is the number of channels, H is the
|
|
|
|
|
height of the feature, and W is the width of the feature.
|
|
|
|
@ -2355,7 +2352,7 @@ def adaptive_pool2d(input,
|
|
|
|
|
None by default.
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
Variable: The output tensor of adaptive pooling result. The data type is same
|
|
|
|
|
Tensor: The output tensor of adaptive pooling result. The data type is same
|
|
|
|
|
as input tensor.
|
|
|
|
|
|
|
|
|
|
Raises:
|
|
|
|
@ -2381,9 +2378,9 @@ def adaptive_pool2d(input,
|
|
|
|
|
# wend = ceil((i + 1) * W / n)
|
|
|
|
|
# output[:, :, i, j] = avg(input[:, :, hstart: hend, wstart: wend])
|
|
|
|
|
#
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
data = fluid.data(name='data', shape=[None, 3, 32, 32], dtype='float32')
|
|
|
|
|
pool_out = fluid.layers.adaptive_pool2d(
|
|
|
|
|
import paddle
|
|
|
|
|
data = paddle.rand(shape=[1,3,32,32])
|
|
|
|
|
pool_out = paddle.fluid.layers.adaptive_pool2d(
|
|
|
|
|
input=data,
|
|
|
|
|
pool_size=[3, 3],
|
|
|
|
|
pool_type='avg')
|
|
|
|
@ -2403,9 +2400,9 @@ def adaptive_pool2d(input,
|
|
|
|
|
# wend = ceil((i + 1) * W / n)
|
|
|
|
|
# output[:, :, i, j] = max(input[:, :, hstart: hend, wstart: wend])
|
|
|
|
|
#
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
data = fluid.data(name='data', shape=[None, 3, 32, 32], dtype='float32')
|
|
|
|
|
pool_out = fluid.layers.adaptive_pool2d(
|
|
|
|
|
import paddle
|
|
|
|
|
data = paddle.rand(shape=[1,3,32,32])
|
|
|
|
|
pool_out = paddle.fluid.layers.adaptive_pool2d(
|
|
|
|
|
input=data,
|
|
|
|
|
pool_size=[3, 3],
|
|
|
|
|
pool_type='max')
|
|
|
|
@ -2454,7 +2451,7 @@ def adaptive_pool2d(input,
|
|
|
|
|
return (pool_out, mask) if require_index else pool_out
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@deprecated(since="2.0.0", update_to="paddle.nn.functional.adaptive_pool3d")
|
|
|
|
|
@deprecated(since="2.0.0")
|
|
|
|
|
@templatedoc(op_type="pool3d")
|
|
|
|
|
def adaptive_pool3d(input,
|
|
|
|
|
pool_size,
|
|
|
|
@ -2462,9 +2459,6 @@ def adaptive_pool3d(input,
|
|
|
|
|
require_index=False,
|
|
|
|
|
name=None):
|
|
|
|
|
"""
|
|
|
|
|
:alias_main: paddle.nn.functional.adaptive_pool3d
|
|
|
|
|
:alias: paddle.nn.functional.adaptive_pool3d,paddle.nn.functional.pooling.adaptive_pool3d
|
|
|
|
|
:old_api: paddle.fluid.layers.adaptive_pool3d
|
|
|
|
|
|
|
|
|
|
This operation calculates the output based on the input, pool_size,
|
|
|
|
|
pool_type parameters. Input(X) and output(Out) are in NCDHW format, where N is batch
|
|
|
|
@ -2493,7 +2487,7 @@ def adaptive_pool3d(input,
|
|
|
|
|
Output(i ,j, k) &= \\frac{sum(Input[dstart:dend, hstart:hend, wstart:wend])}{(dend - dstart) * (hend - hstart) * (wend - wstart)}
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
input (Variable): The input tensor of pooling operator, which is a 5-D tensor with
|
|
|
|
|
input (Tensor): The input tensor of pooling operator, which is a 5-D tensor with
|
|
|
|
|
shape [N, C, D, H, W]. The format of input tensor is NCDHW, where
|
|
|
|
|
N is batch size, C is the number of channels, D is the depth of the feature,
|
|
|
|
|
H is the height of the feature, and W is the width of the feature.
|
|
|
|
@ -2508,7 +2502,7 @@ def adaptive_pool3d(input,
|
|
|
|
|
None by default.
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
Variable: The output tensor of adaptive pooling result. The data type is same as input tensor.
|
|
|
|
|
Tensor: The output tensor of adaptive pooling result. The data type is same as input tensor.
|
|
|
|
|
|
|
|
|
|
Raises:
|
|
|
|
|
ValueError: 'pool_type' is not 'max' nor 'avg'.
|
|
|
|
@ -2538,11 +2532,9 @@ def adaptive_pool3d(input,
|
|
|
|
|
# avg(input[:, :, dstart:dend, hstart: hend, wstart: wend])
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
|
|
|
|
|
data = fluid.data(
|
|
|
|
|
name='data', shape=[None, 3, 32, 32, 32], dtype='float32')
|
|
|
|
|
pool_out = fluid.layers.adaptive_pool3d(
|
|
|
|
|
import paddle
|
|
|
|
|
data = paddle.rand(shape=[1,3,32,32,32])
|
|
|
|
|
pool_out = paddle.fluid.layers.adaptive_pool3d(
|
|
|
|
|
input=data,
|
|
|
|
|
pool_size=[3, 3, 3],
|
|
|
|
|
pool_type='avg')
|
|
|
|
@ -2567,11 +2559,9 @@ def adaptive_pool3d(input,
|
|
|
|
|
# avg(input[:, :, dstart:dend, hstart: hend, wstart: wend])
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
|
|
|
|
|
data = fluid.data(
|
|
|
|
|
name='data', shape=[None, 3, 32, 32, 32], dtype='float32')
|
|
|
|
|
pool_out = fluid.layers.adaptive_pool3d(
|
|
|
|
|
import paddle
|
|
|
|
|
data = paddle.rand(shape=[1,3,32,32,32])
|
|
|
|
|
pool_out = paddle.fluid.layers.adaptive_pool3d(
|
|
|
|
|
input=data,
|
|
|
|
|
pool_size=[3, 3, 3],
|
|
|
|
|
pool_type='max')
|
|
|
|
|