maxPooling2dLayer
Description
A max pooling layer performs downsampling by dividing the input
into rectangular pooling regions, and computing the maximum of each region.
Creation
Description
layer = maxPooling2dLayer(poolSize)
creates a max pooling layer and sets the PoolSize
property.
layer = maxPooling2dLayer(poolSize,Name,Value)
sets the optional Stride, Name,
and HasUnpoolingOutputs properties using name-value pairs. To
specify input padding, use the 'Padding' name-value pair
argument. For example, maxPooling2dLayer(2,'Stride',3)
creates a max pooling layer with pool size [2 2] and stride
[3 3]. You can specify multiple name-value pairs. Enclose
each property name in single quotes.
Input Arguments
Name-Value Pair Arguments
Use comma-separated name-value pair arguments to specify the size of the
padding to add along the edges of the layer input and to set the Stride, Name, and HasUnpoolingOutputs properties. Enclose names in single
quotes.Example:maxPooling2dLayer(2,'Stride',3) creates a max
pooling layer with pool size [2 2] and stride [3
3].
'Padding' — Input edge padding
[0 0 0 0] (default) | vector of nonnegative integers | 'same'
Input edge padding, specified as the comma-separated pair consisting of
'Padding' and one of these values:
'same' — Add padding of size calculated by the software at
training or prediction time so that the output has the same size as the input
when the stride equals 1. If the stride is larger than 1, then the output size is
ceil(inputSize/stride), where inputSize is the height
or width of the input and stride is the stride in the corresponding
dimension. The software adds the same amount of padding to the top and bottom, and to the left
and right, if possible. If the padding that must be added vertically has an odd value, then the
software adds extra padding to the bottom. If the padding that must be added horizontally has an
odd value, then the software adds extra padding to the right.
Nonnegative integer p — Add padding of size
p to all the edges of the input.
Vector [a b] of nonnegative integers — Add padding of size
a to the top and bottom of the input and padding of size
b to the left and right.
Vector [t b l r] of nonnegative integers — Add padding of
size t to the top, b to the bottom,
l to the left, and r to the right of
the input.
Example:
'Padding',1 adds one row of padding to the top and bottom, and one
column of padding to the left and right of the input.
Example:
'Padding','same' adds padding so that the output has the same size as
the input (if the stride equals 1).
Properties
Max Pooling
PoolSize — Dimensions of pooling regions
vector of two positive integers
Dimensions of the pooling regions, specified as a vector of two positive integers<