torch.nn.functional.fractional_max_pool3d#
- torch.nn.functional.fractional_max_pool3d(input, kernel_size, output_size=None, output_ratio=None, return_indices=False, _random_samples=None)[source]#
對由多個輸入平面組成的輸入訊號應用 3D 區域最大池化。
區域最大池化在 Ben Graham 的論文 Fractional MaxPooling 中有詳細描述。
最大池化操作在 區域中進行,步長由目標輸出大小透過隨機確定。輸出特徵的數量與輸入平面的數量相同。
- 引數
kernel_size – 用於最大池化的視窗大小。可以是單個數字 (對應大小為 的方形核)或元組 (kT, kH, kW)。
output_size – 目標輸出大小,形式為 。可以是元組 (oT, oH, oW),或者單個數字 ,以生成立方體輸出 。
output_ratio – 如果希望輸出大小是輸入大小的比例,則可以使用此選項。它必須是範圍在 (0, 1) 的數字或元組。
return_indices – 如果設定為
True,則會同時返回索引和輸出。這對於傳遞給max_unpool3d()非常有用。
- 形狀
輸入: 或 。
輸出: 或 ,其中 或
- 示例:
>>> input = torch.randn(20, 16, 50, 32, 16) >>> # pool of cubic window of size=3, and target output size 13x12x11 >>> F.fractional_max_pool3d(input, 3, output_size=(13, 12, 11)) >>> # pool of cubic window and target output size being half of input size >>> F.fractional_max_pool3d(input, 3, output_ratio=(0.5, 0.5, 0.5))