Average Pooling

An Average Pooling layer is one special case of “convolutional”-like operation. It is an operation that takes as input as tensor of size (N, C, H, W) and outputs a tensor of size (N, C, Hout, Wout) where \(N\) means the size of batches, \(C\) the number of channels and \(H, W\) the width and height of the input. Average pooling in Convolutional Neural Networks progressively reduces the (spatial) size of representations between the convolution layers. It returns the average of the values of a sliding window of kernel size “\(K\)”. Refer to “convolutional”-like operations for definitions of “\(K\)”.

PyTorch Usage

>>> m = nn.AvgPool2d(3, stride=2)
>>> m = nn.AvgPool2d((3, 2), stride=(2, 1))
>>> input = torch.randn(20, 16, 50, 32)
>>> output = m(input)