I am getting error for convolution block code. code is all fine but I am getting below error

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 [15], 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.

I am getting error for convolution block code. code is all fine but I am getting below error. In the given structure we dont even have the placeholder to choose training as true or false so How come I get this error and how to fix it

There are lots of details to get right in this code. You’re right that we don’t actually set the training parameter anywhere: that is handled by the test cases for us. But if the values are wrong, that means you code is not fine and we just have to find the problem.

The most common error has to do with not using the correct input tensor for the “shortcut” path, but I think making that error also causes the test to fail for the training = False case.

Maybe it will be necessary to look at your code, but we can’t do that here in a public thread. Please check your DMs for a message from me about how to proceed.

To close the loop on the public thread, the problem was with the input value to the shortcut path, as I suggested in my earlier response. You need to use the saved value from before the “Main Path” section.

The instructions may not be so clear on this point, but the diagram of how the data flows is pretty clear. Maybe another example in which a picture is worth more than words. :smile: