Your pool_forward() function is returning the wrong values for ‘A’.
For the “max” calculation, the values are wrong. So I suspect a_prev_slice values are wrong.
For the “average” calculation, the values should not be all-zeros. So there’s a big problem there.
Tip:
When you compute vert_start and horz_start, it is important that it includes multiplying by “stride”.