FractionalMaxPool3d#
- class torch.nn.FractionalMaxPool3d(kernel_size, output_size=None, output_ratio=None, return_indices=False, _random_samples=None)[source]#
對由多個輸入平面組成的輸入訊號應用 3D 分數最大池化。
Fractional MaxPooling 的詳細描述請參見論文 Fractional MaxPooling (作者: Ben Graham)。
最大池化操作是在 區域中執行的,步長由目標輸出大小隨機確定。輸出特徵的數量等於輸入平面的數量。
注意
必須定義
output_size或output_ratio中的一個且僅一個。- 引數
kernel_size (Union[int, tuple[int, int, int]]) – 取最大值的視窗大小。可以是單個數字 k(表示 k x k x k 的方形核)或一個元組 (kt x kh x kw),k 必須大於 0。
output_size (Union[int, tuple[int, int, int]]) – 影像的目標輸出大小,形式為 oT x oH x oW。可以是一個元組 (oT, oH, oW) 或一個表示方形影像 oH x oH x oH 的單個數字 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)