%% Create Average Pooling Layer with Nonoverlapping Pooling Regions
% Create an average pooling layer with nonoverlapping pooling regions.

layer = averagePooling2dLayer(2,'Stride',2)

% The height and width of the rectangular regions (pool size) are both 2. The pooling regions do not overlap because the step size for traversing the images vertically and horizontally (stride) is also 2.
% Include an average pooling layer with nonoverlapping regions in a Layer array.

layers = [ ...
    imageInputLayer([28 28 1])
    convolution2dLayer(5,20)
    reluLayer
    averagePooling2dLayer(2,'Stride',2)
    fullyConnectedLayer(10)
    softmaxLayer
    classificationLayer]

% Copyright 2012 The MathWorks, Inc.