Getting Error on residual networks programing exersise

I am getting this error on the test. I tried to change the stride length the padding I looked for syntax errors but nothing seems to work. Here is the error that I am getting. (This is in Residual_Networks the first function of the exersise.)

AssertionError Traceback (most recent call last)
Input In [49], 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/, 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

And here is my code for the function

{moderator edit - solution code removed}

Your code does not correctly implement what they gave you in the instructions. Check the parameters you passed on the “second component” of the main path. BTW we’re not supposed to post our code in a public way here. No harm done, as I will just edit your post to remove the code.

sorry I forgot that I was not supposed to be posting my code

normalizing the channels axis… what exactly does that mean ? Thats the only parameter that I can see that I did not include in my second component. I currently have it as axis=3 but I am not sure what that is doing. Is that normalizing channels access or not ?

I just figured it out I had to change the kernal size to f,f instead of just 1

Exactly. The source code actually was pretty useful in this case and no harm was really done, as I edited it out once I had replied.

1 Like