MaxUnpool3d#
- class torch.nn.MaxUnpool3d(kernel_size, stride=None, padding=0)[source]#
计算
MaxPool3d
的一个部分逆运算。MaxPool3d
不是完全可逆的,因为非最大值会被丢失。MaxUnpool3d
以MaxPool3d
的输出来作为输入,包括最大值的索引,并计算一个部分逆运算,其中所有非最大值都被设置为零。注意
当输入索引存在重复值时,此操作可能表现出非确定性。更多信息请参阅 pytorch/pytorch#80827 和 可复现性。
注意
MaxPool3d
可以将多个输入大小映射到相同的输出大小。因此,逆运算可能会产生歧义。为了解决这个问题,您可以在 forward 调用中提供所需的输出大小作为附加参数output_size
。请参阅下面的“输入”部分。- 参数
- 输入
input: the input Tensor to invert
indices:由
MaxPool3d
输出的索引output_size (optional): the targeted output size
- 形状
输入: 或 。
输出: 或 ,其中
or as given by
output_size
in the call operator
示例
>>> # pool of square window of size=3, stride=2 >>> pool = nn.MaxPool3d(3, stride=2, return_indices=True) >>> unpool = nn.MaxUnpool3d(3, stride=2) >>> output, indices = pool(torch.randn(20, 16, 51, 33, 15)) >>> unpooled_output = unpool(output, indices) >>> unpooled_output.size() torch.Size([20, 16, 51, 33, 15])