mindspore.mint.nn.AvgPool2d

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

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

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

Supported Platforms:

Ascend

Examples

>>> import numpy as np
>>> from mindspore import Tensor, mint
>>> from mindspore import dtype as mstype
>>> input = Tensor(np.arange(1 * 3 * 3 * 4).reshape(1, 3, 3, 4), mstype.float32)
>>> net = mint.nn.AvgPool2d(kernel_size=2, stride=1)
>>> output = net(input)
>>> print(output.shape)
(1, 3, 2, 3)