I’ve got my code right but honestly, I didn’t understand how the loop is working espacilly for h and w loop, I had the reflexe that the loop must step by the stride.
If we take the example that is below the function, n_H_prev =5 so n_H = 3 and I don’t know how the h will be equal to 4 at the end of the loop.
to be clear, A_prev_pad in the example will have a shape of (2,7,9,4) so the h must pass by 0,2 and 4 but how the loop is set correct h can never be equal to 4.
and the same thing for the w where it must pass by 0,2,4,6 but will not in the loop
The test cases are bad: they don’t catch the error if you omit the stride. The grader catches it, though.
In terms of visualizing all this, it’s important to be clear about the difference between the input space and the output space. The loops are over the output space and we must not skip any positions there, but the striding happens in the input space.