Residual_Networks : AssertionError: Looks like the BatchNormalization units are not working

I think my code is correct, but errors keep coming:

AssertionError Traceback (most recent call last)
Input In [4], 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:36, in identity_block_test(target)
33 assert np.floor(resume[1, 1, 0]) == 2 * np.floor(resume[1, 1, 3]), “Check the padding and strides”
34 assert np.floor(resume[1, 1, 0]) == 2 * np.floor(resume[1, 1, 3]), “Check the padding and strides”
—> 36 assert resume[1, 1, 0] - np.floor(resume[1, 1, 0]) > 0.7, “Looks like the BatchNormalization units are not working”
38 assert np.allclose(resume,
39 np.array([[[ 0., 0., 0., 0., ],
40 [ 0., 0., 0., 0., ]],
(…)
44 [290.99988, 290.99988, 290.99988, 146.99994]]]),
45 atol = 1e-5 ), “Wrong values with training=False”
47 # tf.keras.backend.set_learning_phase(True)

AssertionError: Looks like the BatchNormalization units are not working

Tip:
Check this first:
There are three batch normalization layers in the identity_block() function.
The first one should include axis=3. The other two should not.

I tried your tip, problem still there.

Please check your DMs for a message from me about how to proceed. You can recognize DMs in your normal “feed” by the little envelope icon.

Thanks. I did.

1 Like