AdaptiveMaxPool2d#
- class torch.nn.AdaptiveMaxPool2d(output_size, return_indices=False)[source]#
对由多个输入平面组成的输入信号应用 2D 自适应最大池化。
The output is of size , for any input size. The number of output features is equal to the number of input planes.
- 参数
- 形状
输入: 或 。
输出: 或 ,其中 。
示例
>>> # target output size of 5x7 >>> m = nn.AdaptiveMaxPool2d((5, 7)) >>> input = torch.randn(1, 64, 8, 9) >>> output = m(input) >>> # target output size of 7x7 (square) >>> m = nn.AdaptiveMaxPool2d(7) >>> input = torch.randn(1, 64, 10, 9) >>> output = m(input) >>> # target output size of 10x7 >>> m = nn.AdaptiveMaxPool2d((None, 7)) >>> input = torch.randn(1, 64, 10, 9) >>> output = m(input)