mindspore.mint.nn.AvgPool3d

View Source On Gitee
class mindspore.mint.nn.AvgPool3d(kernel_size, stride=None, padding=0, ceil_mode=False, count_include_pad=True, divisor_override=None)[source]

Applies a 3D average pooling over an input Tensor which can be regarded as a composition of 3D input planes.

Warning

This is an experimental API that is subject to change or deletion.

For details, please refer to mindspore.mint.nn.functional.avg_pool3d().

Supported Platforms:

Ascend

Examples

>>> import mindspore as ms
>>> pool = ms.mint.nn.AvgPool3d(kernel_size=3, stride=1)
>>> x = ms.ops.randn(1, 2, 4, 4, 5).astype(ms.float32)
>>> output = pool(x)
>>> print(output.shape)
(1, 2, 2, 2, 3)
>>> x1 = ms.ops.randn(6, 5, 7, 7, 5).astype(ms.float32)
>>> pool2 = ms.mint.nn.AvgPool3d(4, stride=2, padding=(2, 2, 1), divisor_override=10)
>>> output2 = pool2(x1)
>>> print(output2.shape)
(6, 5, 4, 4, 2)