Hi
I’m getting the error AssertionError: Check the padding and strides
I’ve set stride to (1,1) for each of the three steps as requested in the instructions. I have padding = “valid” for steps 1 and 3 and as “same” for step 2 also as requested. My output is wrong as shown below. Any ideas for things other than the stride and padding that could be causing this?
With training=False
[[[ 0. 0. 0. 0. ]
[ 0. 0. 0. 0. ]]
[[ 48.99998 48.99998 48.99998 48.99998]
[ 48.99998 48.99998 48.99998 48.99998]]
[[146.99994 146.99994 146.99994 146.99994]
[146.99994 146.99994 146.99994 146.99994]]]
48.99998
With training=True
[[[0. 0. 0. 0. ]
[0. 0. 0. 0. ]]
[[0.29289 0.29289 0.29289 0.29289]
[0.29289 0.29289 0.29289 0.29289]]
[[4.41421 4.41421 4.41421 4.41421]
[4.41421 4.41421 4.41421 4.41421]]]
1 Like
Please share the error by a screenshot image without sharing any codes
Thank you
Regards
DP
The header has week 2 assignment 1 Tom
Here is the error
AssertionError Traceback (most recent call last)
Input In [12], in <cell line: 30>()
26 A4 = identity_block(X, f=2, filters=[3, 3, 3],
27 initializer=lambda seed=0:constant(value=1))
28 print(np.around(A4.numpy()[:,(0,-1),:,:].mean(axis = 3), 5))
—> 30 public_tests.identity_block_test(identity_block)
File /tf/W2A1/public_tests.py:31, in identity_block_test(target)
28 assert np.all(A3np >= 0), “The ReLu activation at the last layer is missing”
29 resume = A3np[:,(0,-1),:,:].mean(axis = 3)
—> 31 assert np.floor(resume[1, 0, 0]) == 2 * np.floor(resume[1, 0, 3]), “Check the padding and strides”
32 assert np.floor(resume[1, 0, 3]) == np.floor(resume[1, 1, 0]), “Check the padding and strides”
33 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
1 Like
TMosh
December 29, 2023, 5:52pm
6
However, “stride” and “padding” are not used in Course 1, which is what the topic “Neural Networks and Deep Learning” references.
I’m willing to guess this should be in the C4 “Convolutional NN” course forum.
Yes its the CNN course. Did I submit this in the wrong place?
1 Like
TMosh
December 29, 2023, 5:55pm
8
Slightly. There are sub-forums for each of the 5 courses in DLS. I’ll move it to the correct forum.
Check your variable name. Your OP mentions “stride”, but the parameter name is “strides”.
I did use strides Not stride. Sorry for the typo in my question.
1 Like
TMosh
December 29, 2023, 5:58pm
10
What did you use for “filters” and “kernel_size” in each layer?
1 Like
for filters I used F1, F2, and F3 respectively. For kernel size I used 1. Should I have used kernel size f in step two? I’ll try that.
1 Like
Changing the filer size to f in the second step did the trick Thanks for you help.
1 Like