• 文档 >
  • torch.nn >
  • 自适应平均池化 2d
快捷键

自适应平均池化 2d ¶

类 torch.nn.AdaptiveAvgPool2d(output_size)[source][source] ¶

对由多个输入平面组成的输入信号应用 2D 自适应平均池化。

输出大小为 H x W,适用于任何输入大小。输出特征的数量等于输入平面的数量。

参数:

output_size(联合[int, None, tuple[Optional[int], Optional[int]]])- 目标输出图像的大小,形式为 H x W。可以是元组(H, W)或单个 H 以形成正方形图像 H x H。H 和 W 可以是 intNone ,这意味着大小将与输入相同。

形状:
  • 输入: (N,C,Hin,Win)(N, C, H_{in}, W_{in})(C,Hin,Win)(C, H_{in}, W_{in})

  • 输出: (N,C,S0,S1)(N, C, S_{0}, S_{1})(C,S0,S1)(C, S_{0}, S_{1}) ,其中 S=output_sizeS=\text{output\_size}

示例

>>> # target output size of 5x7
>>> m = nn.AdaptiveAvgPool2d((5, 7))
>>> input = torch.randn(1, 64, 8, 9)
>>> output = m(input)
>>> # target output size of 7x7 (square)
>>> m = nn.AdaptiveAvgPool2d(7)
>>> input = torch.randn(1, 64, 10, 9)
>>> output = m(input)
>>> # target output size of 10x7
>>> m = nn.AdaptiveAvgPool2d((None, 7))
>>> input = torch.randn(1, 64, 10, 9)
>>> output = m(input)

© 版权所有 PyTorch 贡献者。

使用 Sphinx 构建,并使用 Read the Docs 提供的主题。

文档

PyTorch 的全面开发者文档

查看文档

教程

深入了解初学者和高级开发者的教程

查看教程

资源

查找开发资源并获得您的疑问解答

查看资源