NumPy allowed · plain Python earns 10 bonus points
Downsample spatial representations and extract dominant features using 2D max pooling.
Implement max_pool2d_forward(x, pool_size=2, stride=2): slide a square window of size pool_size x pool_size with step size stride over 2D input x. For each window position, take the maximum element. Round output floats to 4 decimal places.
max_pool2d_forward(x: list[list[float]], pool_size: int = 2, stride: int = 2) -> list[list[float]]