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)[源代码]

对输入张量应用二维平均池化,可视为二维输入平面的组合。

更多参考详见 mindspore.mint.nn.functional.avg_pool2d()

支持平台:

Ascend

样例:

>>> 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)