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)