Assignment 1 - Exercise 3 (Conv Forward)

Ok I am getting the folllowing error while Implementing the function

A prev_padding Size (2, 7, 9, 4) Zshape_Size (2, 3, 4, 8)
Z's mean =
 -0.16586845236477832
Z[0,2,1] =
 [0. 0. 0. 0. 0. 0. 0. 0.]
cache_conv[0][1][2][3] =
 [-1.1191154   1.9560789  -0.3264995  -1.34267579]
First Test: Z's mean is incorrect. Expected: 0.5511276474566768 
Your output: -0.16586845236477832 

First Test: Z[0,2,1] is incorrect. Expected: [-2.17796037, 8.07171329, -0.5772704, 3.36286738, 4.48113645, -2.89198428, 10.99288867, 3.03171932] 
Your output: [0. 0. 0. 0. 0. 0. 0. 0.] 

I wrote the following code

{mentor edit: code removed}

Can anyone help in providing a hint where I could have done wrong, is it something I have done wrong in for loop etc or before. I suspect there might be some error in how I am definaing horizontal start and vert start but I cant see how it would be anything else than 0 since the filter would start convoluting from upper left corner,

Also the lab mention remember (vert start horiz start) they are the indices of previous layer,whats that supposed to mean, shouldnt every filter start from 0,0 position

You are using “stride” incorrectly.
Do not use it in the for- iterator. This makes your code skip over values that need to be evaluated.
You should use stride as a multiplier in computing vert_start and horiz_start.

Thank you for response I did that I am now getting shape mismatch error

operands could not be broadcast together with shapes (3,3,4) (3,0,4) 

{mentor edit: code removed}

The argument for “i = range(…)” is incorrect. That should be ‘m’. It was computed earlier in the function.

Your slicing for ‘weights’ is incorrect. You should only specify the last parameter ‘c’.

Your slicing for a_slice_prev is incorrect. The last parameter should be ‘:’.

Please don’t post your code on the Forum. That’s not allowed by the Honor Code.

Oh Thanks Lets see If i can figure out
Sorry I wont copy the code from now on… I didnt read the honour code thoroughly …

Oh Thanks Lets see If i can figure out
Sorry I wont copy the code from now on… I didnt read the honour code thoroughly …

I’m ashamed to say how much time I wasted trying to figured out that. Thanks!