The only error I am getting is that my mean is different than what is expected. I cant find where the issue is.
<code removed>
# YOUR CODE ENDS HERE
ERROR :
AssertionError: Wrong Z mean. Expected: -0.5384027772160062 got: -0.5673855301683194
What should I look to correct in this ?
Mean is the ratio of the sum of all elements to the number of elements, right? So the problem could be either in the numerator or the denominator. If it’s the denominator that means the matrix Z
is the wrong size. Check the dimensions used to create and initialize the variable. However, if the shape was wrong you probably would have experienced a runtime error. So the problem is more likely in the numerator. It could either be the number of non-zero values, or the values themselves. The number of non-zero values is controlled by the iteration ranges. The values come from your convolution computation.
Using a process like this allows you to reason about where to focus. You could then add some print statements to examine intermediate values or execution traces to further expose what is happening. Let us know what you find?
2 Likes
PS: you should also consider using the forum search to see if others have experienced (and perhaps resolved) this issue…
https://community.deeplearning.ai/search?q=Wrong%20%E2%80%9DZ%20mean%E2%80%9D
1 Like
Thanks a ton , I figured it out , while ‘vert_stride’ I mistakenly looped it over ‘i’ instead of ‘h’.
2 Likes
Thanks for the feedback and sharing the lesson learned that will help others in the future.
I too got stuck in this for a lot of time, finally realized that I was making mistake in dimensions for a_slice_prev. Closely follow the dimension noting in what order we are slicing the vertical dimension and the horizontal dimension. Its very hard to notice the error due to order sometimes!!