nn.AdaptiveAvgPool2d和nn.AdaptiveAvgPool3d

官方给出的例子:
>>> # target output size of 5x7
>>> m = nn.AdaptiveMaxPool2d((5,7))
>>> input = torch.randn(1, 64, 8, 9)
>>> output = m(input)
>>> output.size()
torch.Size([1, 64, 5, 7])

>>> # target output size of 7x7 (square)
>>> m = nn.AdaptiveMaxPool2d(7)
>>> input = torch.randn(1, 64, 10, 9)
>>> output = m(input)
>>> output.size()
torch.Size([1, 64, 7, 7])

>>> # target output size of 10x7
>>> m = nn.AdaptiveMaxPool2d((None, 7))
>>> input = torch.randn(1, 64, 10, 9)
>>> output = m(input)
>>> output.size()
torch.Size([1, 64, 10, 7])

>>> # target output size of 1x1x1
>>> m = nn.AdaptiveMaxPool3d((1,1,1))
>>> input = torch.randn(1, 64, 8, 8, 9)
>>> output = m(input)
>>> output.size()
torch.Size([1, 64, 1, 1, 1])

 

你可能感兴趣的:(Pytorch,深度学习,算法)