\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})\\Output(i ,j, k) &= max(Input[dstart:dend, hstart:hend, wstart:wend])\end{aligned}\end{align}

## 参数¶

• output_size (int|list|tuple): 算子输出特征图的高宽长大小，其数据类型为int,list或tuple。

• name (str，可选): 操作的名称(可选，默认值为None）。更多信息请参见 Name

## 形状¶

• x (Tensor): 默认形状为（批大小，通道数，输出特征深度，高度，宽度），即NCDHW格式的5-D Tensor。 其数据类型为float32或者float64。

• output (Tensor): 默认形状为（批大小，通道数，输出特征深度，高度，宽度），即NCDHW格式的5-D Tensor。 其数据类型与输入x相同。

## 代码示例¶

# adaptive max pool3d
# suppose input data in shape of [N, C, D, H, W], output_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 max 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] =
#                     max(input[:, :, dstart:dend, hstart: hend, wstart: wend])