評價此頁

AdaptiveMaxPool3d#

class torch.nn.AdaptiveMaxPool3d(output_size, return_indices=False)[原始碼]#

對由多個輸入平面組成的輸入訊號應用 3D 自適應最大池化。

對於任何輸入尺寸,輸出尺寸為 Dout×Hout×WoutD_{out} \times H_{out} \times W_{out}. 輸出的通道數與輸入的通道數相同。

引數
  • output_size (Union[int, None, tuple[Optional[int], Optional[int], Optional[int]]) – 目標影像輸出尺寸,形式為 Dout×Hout×WoutD_{out} \times H_{out} \times W_{out}. 可以是元組 (Dout,Hout,Wout)(D_{out}, H_{out}, W_{out}) 或單個 DoutD_{out} 表示一個立方體 Dout×Dout×DoutD_{out} \times D_{out} \times D_{out}. DoutD_{out}, HoutH_{out} and WoutW_{out} can be either an int, or None, which means the size will be the same as that of the input.

  • return_indices (bool) – if True, will return the indices along with the outputs. Useful to pass to nn.MaxUnpool3d. Default: False

形狀
  • Input: (N,C,Din,Hin,Win)(N, C, D_{in}, H_{in}, W_{in}) or (C,Din,Hin,Win)(C, D_{in}, H_{in}, W_{in}).

  • Output: (N,C,Dout,Hout,Wout)(N, C, D_{out}, H_{out}, W_{out}) or (C,Dout,Hout,Wout)(C, D_{out}, H_{out}, W_{out}), where (Dout,Hout,Wout)=output_size(D_{out}, H_{out}, W_{out})=\text{output\_size}.

示例

>>> # target output size of 5x7x9
>>> m = nn.AdaptiveMaxPool3d((5, 7, 9))
>>> input = torch.randn(1, 64, 8, 9, 10)
>>> output = m(input)
>>> # target output size of 7x7x7 (cube)
>>> m = nn.AdaptiveMaxPool3d(7)
>>> input = torch.randn(1, 64, 10, 9, 8)
>>> output = m(input)
>>> # target output size of 7x9x8
>>> m = nn.AdaptiveMaxPool3d((7, None, None))
>>> input = torch.randn(1, 64, 10, 9, 8)
>>> output = m(input)
forward(input)[原始碼]#

執行前向傳播。