The pooling operation, on the other hand, applies a summary statistic (e.g. maximum, average, etc.) to each sub-region of the input by sliding a kernel (or filter) with a certain stride size, resulting in an output with reduced dimensions compared to the input. Pooling introduces local invariance properties to the output, including translational and rotational invariance. Translational invariance is achieved because the pooling operation is applied independently to each sub-region, allowing it to detect the same features regardless of their position within the sub-region. Rotational invariance is a consequence of the pooling operation being insensitive to the orientation of the features within the sub-region. These local invariance properties make the output more robust to small changes in the input, improving the generalization performance of the CNN.