DLS CNN Week 1 Assignment 1

I am facing problem with Exercise 3 in Conv NN. Following is the error I am receiving when I am calculating Z:
First Test: Z’s mean is incorrect. Expected: 0.5511276474566768
Your output: 0.5329033220060434 . Make sure you include stride in your calculation

Did you search the forum? Apparently, a lot of learners have gotten the same incorrect value.
Here’s the community user guide to get started.

If you’re unable to find the solution, please click my name and message your notebook as an attachment.

I did. I am not able to find how to use Stride. I am using vert_start=h+stride-1; However, what happens if stride is 2 in first instance. In that case, for the first time calc of vert_start, the slice will start from 0+2-1=1.

No worries. Please see the picture for Max Pool with stride 2. It should become clear that stride refers to the increment. To keep the discussion simple, let’s look at horizontal stride since vertical stride should follow similar logic.

When stride = 1, you move the filter 1 step to the right horizontally after completing the current step. Here are some values to make things clear:
When stride = 1, the filter left end should start at values 0, 1, 2, 3, etc.
When stride = 2, filter left end should start at values 0, 2, 4, 6, etc.
When stride = 3, filter left end should start at values 0, 3, 6, 9, etc.
When stride = 4, filter left end should start at values 0, 4, 8, 12, etc.

Got it! Resolved. Thanks a lot