Course 4 Week 1 assignment 1 exercise 5 conv_backward wrong values error

I’m getting a really frustrating error. Wrong values. Not sure how to navigate this, but the shapes seem to be correct, and the code is essentially written for us. I poured over the code, and can’t seem to find what’s wrong

It looks like db is correct, but dA and dW are wrong. But looking over the code, the only part that was not overtly given to us was a_slice. From the description, " Where 𝑎_𝑠𝑙𝑖𝑐𝑒 corresponds to the slice which was used to generate the activation Z_ij" and the code comment “Use the corners to define the slice from a_prev_pad”, it seems correct to me. Does anyone see what’s wrong?

{Moderator Edit: Code Removed}

Please note that posting your code is not allowed. I will delete it after this reply.

Your implementation of vert_start, vert_end, horiz_start, and horiz_end are not correct. Why you are using pad here? We have to use stride, not pad. And, your addition is also not correct. Check this post which explains how to use addition and multiplication for this.

Best,
Saif.