torch.nn.AdaptiveAvgPool1d(output_size) #output_size:输出尺寸
# target output size of 5 m = nn.AdaptiveAvgPool1d(5) input = autograd.Variable(torch.randn(1, 64, 8)) output = m(input)
对输入信号,提供2维的自适应平均池化操做 对于任何输入大小的输入,能够将输出尺寸指定为H*W
,可是输入和输出特征的数目不会变化。spa
class torch.nn.AdaptiveAvgPool2d(output_size)
参数:.net
H*W
的输出,也可使用耽搁数字H表示H*H大小的输出# target output size of 5x7 m = nn.AdaptiveAvgPool2d((5,7)) input = autograd.Variable(torch.randn(1, 64, 8, 9)) # target output size of 7x7 (square) m = nn.AdaptiveAvgPool2d(7) input = autograd.Variable(torch.randn(1, 64, 10, 9)) output = m(input)
自适应池化的数学解释:code
来源于:传送门blog