Hi,
I am getting an error “Wrong output for variable in position 0”, and above that is this line (2, 13, 15, 8), which I am assuming is the shape of A_prev
but I am not sure, and I don’t understand why it is being printed lol. And I can’t for the life of me figure out what I am doing wrong. I would post the code I wrote here but I am not sure if that would be okay with Coursera’s Honor code. All the shapes seem to be fine, no syntax errors of course, since the code is running. I checked all the things suggested in the additional hints, it seems all good. So I would really appreciate any guidance/pointers, and if I am allowed to post my code, please do that, I’ll post it.
The tricky bits in this function seem to be:
- how you slice A_prev_pad to get a_prev_pad.
- how you compute the start and end values for the horizontal and vertical dimensions. The start values should include a multiplication by “stride”.
- you also have to slice W and b correctly.
- and use the correct ranges for all three for-loops.
3 Likes
Thank you so much, that helped. I was using range(0, n_W, stride)
and similarly for n_H
, so I was ending up skipping some values of h and w entirely, which meant that Z wasn’t being computed at all indices.
The start values should include a multiplication by “stride”
That solved it of course.
Hey,
So the below code would be incorrect?
for h in range(0, n_H, stride):
vert_start = h
vert_end = h + f
Looks like, I also had the same issue as him, and I was using the same code as you said. Just changed to range(n_W) and use multiplication by stride in the start values. That solved all.