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