Skip to content
C

Manual Max Pooling

Mediumpython

Given a 4x4 grid of numbers, apply 2x2 max pooling (stride 2) manually — the exact operation MaxPooling2D performs inside a CNN, shrinking the data while keeping only the most important value from each region.

Approach: slide a non-overlapping 2x2 window across the grid, taking the maximum value in each window to build a smaller 2x2 output grid.

Input: Four lines: the 4x4 grid, one row of 4 space-separated numbers per line.

Output: Two lines: the resulting 2x2 pooled grid, one row per line, each printed as a Python list.

Input (stdin)

Output

Run your code to see output here...