FractionalMaxPool3d¶
- class torch.nn.FractionalMaxPool3d(kernel_size, output_size=None, output_ratio=None, return_indices=False, _random_samples=None)[source][source]¶
在由多個輸入平面組成的輸入訊號上應用 3D 分數最大池化。
分數最大池化(Fractional MaxPooling)在 Ben Graham 的論文 Fractional MaxPooling 中有詳細描述
最大池化操作透過由目標輸出大小確定的隨機步長應用於 區域。輸出特徵的數量等於輸入平面的數量。
注意
必須精確定義
output_size或output_ratio中的一個。- 引數
kernel_size (Union[int, tuple[int, int, int]]) – 進行最大池化的視窗大小。可以是單個數字 k (用於 k x k x k 的方形核) 或元組 (kt x kh x kw)
output_size (Union[int, tuple[int, int, int]]) – 影像的目標輸出尺寸,格式為 oT x oH x oW。可以是元組 (oT, oH, oW) 或單個數字 oH (用於 oH x oH x oH 的方形影像)
output_ratio (Union[float, tuple[float, float, float]]) – 如果希望輸出尺寸是輸入尺寸的比例,可以使用此選項。這必須是介於 (0, 1) 範圍內的數字或元組
return_indices (bool) – 如果為
True,則除了輸出之外還會返回索引。對於傳遞給nn.MaxUnpool3d()很有用。預設值:False
- 形狀
輸入: 或 。
輸出: 或 ,其中 或
示例
>>> # pool of cubic window of size=3, and target output size 13x12x11 >>> m = nn.FractionalMaxPool3d(3, output_size=(13, 12, 11)) >>> # pool of cubic window and target output size being half of input size >>> m = nn.FractionalMaxPool3d(3, output_ratio=(0.5, 0.5, 0.5)) >>> input = torch.randn(20, 16, 50, 32, 16) >>> output = m(input)