AdaptiveMaxPool2d#
- class torch.nn.AdaptiveMaxPool2d(output_size, return_indices=False)[source]#
對由多個輸入平面組成的輸入訊號應用 2D 自適應最大池化。
對於任意輸入尺寸,輸出的尺寸為 . 輸出特徵的數量等於輸入平面的數量。
- 引數
- 形狀
輸入: 或 。
輸出: 或 ,其中 。
示例
>>> # 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)