4 results forcourse 4, week 2, Residual_Networks, Exercise 2 - convolutional_block

i have been working on an error for some time and would appreciate any help:

{moderator edit - solution code removed}

you cannot edit this cell


public_tests.convolutional_block_test(convolutional_block)
tf.Tensor(
[[[1.0763421e+00 0.0000000e+00 3.3232409e-01 0.0000000e+00 7.1733320e-01
2.9889154e-01]
[5.3662288e-01 0.0000000e+00 0.0000000e+00 0.0000000e+00 8.5235703e-01
0.0000000e+00]]

[[4.7234151e-01 0.0000000e+00 0.0000000e+00 0.0000000e+00 8.0212694e-01
6.4355135e-04]
[3.3868679e-01 1.2136540e-01 0.0000000e+00 0.0000000e+00 1.0314488e+00
0.0000000e+00]]], shape=(2, 2, 6), dtype=float32)

AssertionError Traceback (most recent call last)
Input In [20], in <cell line: 3>()
1 ### you cannot edit this cell
----> 3 public_tests.convolutional_block_test(convolutional_block)

File /tf/W2A1/public_tests.py:115, in convolutional_block_test(target)
112 tf.keras.backend.set_learning_phase(True)
114 C = target(X, f = 2, filters = [2, 4, 6])
→ 115 assert np.allclose(C.numpy(), convolutional_block_output2), “Wrong values when training=True.”
117 print(‘\033[92mAll tests passed!’)

AssertionError: Wrong values when training=True.

{moderator edit - solution code removed}

Oops – i added my code. How do i modify my post to remove my code? Also, i found my error

1 Like

I can remove the code for you. Note that a) the comment told you the correct order for the operands on the Add and b) that Add code was just given to you in the template: it’s outside of the “YOUR CODE HERE” sections. But I guess you wouldn’t hit that error until you get past the incorrect input to the Shortcut layer. Hope it is all sorted now …