Course 4 Week 1 Assignment 1 - Exercise 3 - conv_forward

I have been working on this for about a week. I got everything to work but it is not giving me the correct answer. I have the stride in the vert_start and horiz_start as well.

h = 0 vert_start at 0
h=1 vert_start at 2
h=2 vert_start at 4

I am unsure if I am not using the correct filter for W and b.

For weights I am pulling in all of f, f, n_C_prev @ each c in n_C; the same for biases

Everything you say above sounds correct, but your results are obviously not correct. Note that your value for Z[0,2,1] is all zeros, but it should not be. Are you sure that you are not skipping any positions in the output? In other words, using the stride in the loop limits would be a mistake. You must touch every position of the output: the skipping caused by the striding happens only in the “input” space, right?

Have you seen this thread, which gives a nice overview of what the code needs to do in conv_forward.

I am doing exactly as the thread, and I step through the code step by step checking the shape along the way. I am not sure why I am getting all Zeros. I am looping through each value of I, h, w and c, the stride comes in only in the vert_start and horiz_start. h times stride and w times stride.

I am also using Z[i, h, w, c] and conv_single_step to capture every value along the way. that’s why I can’t figure out what I did wrong.

Check your DMs for a message from me about how to share code.

To close the loop on the public thread here, the problem turned out to be incorrect indentation in the innermost loop over c. Not all the code was correctly included in the innermost loop. In python, the indentation is a critical part of the syntax. In particular, it determines the “body” of each loop.