Course 4 Week 1 Assignment 1 Exercise 3 - conv_forward

Error: Wrong output for variable in position 0.

I have looped over the dimensions of the output volume, accounted for stride inside the loops for the start and end, and also sliced W,b and a_prev_pad properly but I am still facing this issue. Please help!

You’re supposed to slice A_prev_pad, not a_prev_pad.

Yeah, I have done that too in the for loop over the batch of training examples( i ). The a_prev_pad I was referring to was inside the for loop over the channels ( c ). I have read all the topics related to this error and my code accounts for all the fixes given in them but I’m still encountering the error.

I am seeing same behavior.

  • Got dimensions from A_prev, W
  • With stride, pad calculated n_H and n_W
  • Got A_prev_pad from A_prev
  • in the loop, for every training entry, for every n_H, for every n_W and for ever n_C, I ran convolution on A_prev_pad[i, …].

Output says, not all tests passed.

I accounted for strides when I got the slice from A_prev_pad also. Anything else I need to do here? All my slices are of size (3, 3, 4) and W is of size (3, 3, 4) after slicing. b is (1, 1, 1)

Same problem here. Any hints?

Have figured it out now. Think twice about the stride compensation in “vert_start” and “horiz_start”.

1 Like

Its working now. As @Bryanby commented, think about how this stride works in the scheme of n_H and n_W.

Basically you get the following:

  • vert_start = hstride; vert_stop = hstride +f
  • horiz_start = hstride; horiz_stop = hstride +f