Warning: API “paddle.fluid.layers.nn.adaptive_pool3d” is deprecated since 2.0.0, and will be removed in future versions.

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 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. Parameters(pool_size) should contain three elements which represent height and width, respectively. Also the D, H and W dimensions of output(Out) is same as Parameter(pool_size). The output tensor shape will be [N, C, pool_size, pool_size, pool_size]

\begin{align}\begin{aligned}dstart &= floor(i * D_{in} / D_{out})\\dend &= ceil((i + 1) * D_{in} / D_{out})\\hstart &= floor(j * H_{in} / H_{out})\\hend &= ceil((j + 1) * H_{in} / H_{out})\\wstart &= floor(k * W_{in} / W_{out})\\wend &= ceil((k + 1) * W_{in} / W_{out})\\\begin{split}Output(i ,j, k) &= \\frac{sum(Input[dstart:dend, hstart:hend, wstart:wend])}{(dend - dstart) * (hend - hstart) * (wend - wstart)}\end{split}\end{aligned}\end{align}
Args:
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. The data type is float32 or float64.

pool_size (int|list|tuple): The pool kernel size. If pool kernel size is a tuple or list,

it must contain three integers, (Depth, Height, Width).

Definition list ends without a blank line; unexpected unindent.

pool_type: (string) Pooling type, can be “max” for max-pooling and “avg” for average-pooling require_index (bool): If true, the index of max pooling point will be returned along

Unexpected indentation.

with outputs. It cannot be set in average pooling type. Default False.

Block quote ends without a blank line; unexpected unindent.

name(str, optional): For detailed information, please refer

to Name. Usually name is no need to set and None by default.

Returns:

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’. ValueError: invalid setting ‘require_index’ true when ‘pool_type’ is ‘avg’. ValueError: ‘pool_size’ should be a list or tuple with length as 2.

Examples:
# average adaptive pool3d
# suppose input data in shape of [N, C, D, H, W], pool_size is [l, m, n],
# output shape is [N, C, l, m, n], adaptive pool divide D, H and W dimensions
# of input data into l * m * n grids averagely and performs poolings in each
# grid to get output.
# adaptive average pool performs calculations as follow:
#
#     for i in range(l):
#         for j in range(m):
#             for k in range(n):
#                 dstart = floor(i * D / l)
#                 dend = ceil((i + 1) * D / l)
#                 hstart = floor(j * H / m)
#                 hend = ceil((j + 1) * H / m)
#                 wstart = floor(k * W / n)
#                 wend = ceil((k + 1) * W / n)
#                 output[:, :, i, j, k] =
#                     avg(input[:, :, dstart:dend, hstart: hend, wstart: wend])
#

input=data,
pool_size=[3, 3, 3],
pool_type='avg')

# suppose input data in shape of [N, C, D, H, W], pool_size is [l, m, n],
# output shape is [N, C, l, m, n], adaptive pool divide D, H and W dimensions
# of input data into l * m * n grids averagely and performs poolings in each
# grid to get output.
# adaptive average pool performs calculations as follow:
#
#     for i in range(l):
#         for j in range(m):
#             for k in range(n):
#                 dstart = floor(i * D / l)
#                 dend = ceil((i + 1) * D / l)
#                 hstart = floor(j * H / m)
#                 hend = ceil((j + 1) * H / m)
#                 wstart = floor(k * W / n)
#                 wend = ceil((k + 1) * W / n)
#                 output[:, :, i, j, k] =
#                     avg(input[:, :, dstart:dend, hstart: hend, wstart: wend])
#