MAXUNPOOL使用
将包含最大值索引的输出作为输入,MaxPool2d 并计算部分逆,其中所有非最大值都设置为零。
pool = nn.MaxPool2d(2, stride=2, return_indices=True)
unpool = nn.MaxUnpool2d(2, stride=2)
input = torch.tensor([[[[ 1., 2, 3, 4],
[ 5, 6, 7, 8],
[ 9, 10, 11, 12],
[13, 14, 15, 16]]]])
output, indices = pool(input)
unpool(output, indices)
》》》tensor([[[[ 0., 0., 0.,
MAXUNPOOL使用最先出现在Python成神之路。
共有 0 条评论