%% Create Max Pooling 3-D Layer with Nonoverlapping Pooling Regions
% Create a max pooling 3-D layer with nonoverlapping pooling regions.

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

% The height, width, and depth of the cuboidal regions (pool size) are 2. The step size for traversing the images (stride) is 2 in all dimensions. The pooling regions do not overlap because the stride is greater than or equal to the corresponding pool size in all dimensions.
% Include a max pooling layer with nonoverlapping regions in a Layer array.

layers = [ ...
    image3dInputLayer([28 28 28 3])
    convolution3dLayer(5,20)
    reluLayer
    maxPooling3dLayer(2,'Stride',2)
    fullyConnectedLayer(10)
    softmaxLayer
    classificationLayer]

% Copyright 2018 The MathWorks, Inc.