Pooling layers are used to downsample. They are generally used with convolutional layers to reduce the size of the feature space
Max pooling uses passes the max value over a window to the next layer. There are three different pooling layer dimensions:
tf.keras.layers.MaxPooling2D(
pool_size=(2, 2),
strides=None,
padding="valid",
data_format=None,
**kwargs
)
output_shape = (input_shape - pool_size + 1) / strides)
output_shape = input_shape / strides
Average pooling passes the average value over a window to the next layer. There are three different pooling layer dimensions:
tf.keras.layers.AveragePooling2D(
pool_size=(2, 2), strides=None, padding="valid", data_format=None, **kwargs
)
Args same as MaxPooling
There are also GlobalMaxPooling and GlobalAveragePooling varients that don't use a window, but the entire input.