%% Create Global Average Pooling Layer
% Create a global average pooling layer with the name 'gap1'.

layer = globalAveragePooling2dLayer('Name','gap1')

% Include a global average pooling layer in a Layer array.

layers = [ ...
    imageInputLayer([28 28 1])
    convolution2dLayer(5,20)
    reluLayer
    globalAveragePooling2dLayer
    fullyConnectedLayer(10)
    softmaxLayer
    classificationLayer]

% Copyright 2019 The MathWorks, Inc.