DLS 4, Week 2, Exercise 1 - AssertionError: Check the padding and strides

I have checked that my padding and strides are the same as stated in the instruction. but i can’t seem to get it to work

Hi, Julius.

It might give us a little more to go on if you would “copy/paste” the actual exception trace that you got.

With training=False

[[[ 0. 0. 0. 0. ]
[ 0. 0. 0. 0. ]]

[[ 48.92808 48.92808 48.92808 48.92808]
[ 48.92808 48.92808 48.92808 48.92808]]

[[146.78426 146.78426 146.78426 146.78426]
[146.78426 146.78426 146.78426 146.78426]]]
48.928085

With training=True

[[[0. 0. 0. 0. ]
[0. 0. 0. 0. ]]

[[0.29298 0.29298 0.29298 0.29298]
[0.29298 0.29298 0.29298 0.29298]]

[[4.41404 4.41404 4.41404 4.41404]
[4.41404 4.41404 4.41404 4.41404]]]

AssertionError Traceback (most recent call last)
in
22 print(np.around(A4.numpy()[:,(0,-1),:,:].mean(axis = 3), 5))
23
—> 24 public_tests.identity_block_test(identity_block)

/tf/W2A1/public_tests.py in identity_block_test(target)
25 resume = A3np[:,(0,-1),:,:].mean(axis = 3)
26
—> 27 assert np.floor(resume[1, 0, 0]) == 2 * np.floor(resume[1, 0, 3]), “Check the padding and strides”
28 assert np.floor(resume[1, 0, 3]) == np.floor(resume[1, 1, 0]), “Check the padding and strides”
29 assert np.floor(resume[1, 1, 0]) == 2 * np.floor(resume[1, 1, 3]), “Check the padding and strides”

AssertionError: Check the padding and strides

If you’re sure that your stride, padding and filter sizes are correct, there are other things to check as well:

Make sure that you’ve include the BatchNorm layers and that they should all look exactly like the example that they give you in the template code. Make sure you get the “axis” argument correctly specified on those.

Did you get the “ReLU” layers in the right places? Note that you don’t put a ReLU after the third layer: it happens only after you’ve added in the “shortcut”, right?

This assignment is an excruciating exercise in proofreading and carefully following instructions. There are a lot of details and they all need to be correct.

2 Likes

I’m getting the exact same exception and same values. What was the fix for this?

Actually just figured it out lol.

What was the fix? I am getting the same error!

how did u fixed sir i have the same prob

I got the same issue.
I fixed by checking the filter dimensions of F2 (kernel_size)

1 Like

Thank you , the kernal size of f2 need to be kernel_size = f .

2 Likes