mindspore.mint.nn.AvgPool2d
- 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 >>> x = Tensor(np.arange(1 * 3 * 3 * 4).reshape(1, 3, 3, 4), mstype.float32) >>> m = mint.nn.AvgPool2d(x, kernel_size=2, stride=1) >>> output = m(x) >>> print(output) [[[[ 2.5 3.5 4.5] [ 6.5 7.5 8.5]] [[14.5 15.5 16.5] [18.5 19.5 20.5]] [[26.5 27.5 28.5] [30.5 31.5 32.5]]]]