W2_Assignment1: Incorrect Assertion error

Hi,
I am currently doing assignment 1 - Convolutional_block exercise.
This is the error i am getting -

AssertionError                            Traceback (most recent call last)
<ipython-input-16-869d2d1d4c16> in <module>
     12 assert type(A) == EagerTensor, "Use only tensorflow and keras functions"
     13 assert tuple(tf.shape(A).numpy()) == (3, 2, 2, 6), "Wrong shape."
---> 14 assert np.allclose(A.numpy(), convolutional_block_output1), "Wrong values when training=False."
     15 print(A[0])
     16 

AssertionError: Wrong values when training=False.

I am not sure why there is an assertion error here. I have used X_shortcut where needed as well after going through previous posts on this topic.
Could you please let me know where i am going wrong?

Thank you.

This whole assignment is an excruciating exercise in proof-reading: there are lots of details, any one of which can throw off your results. Are you sure you checked your “BatchNorm” layers? They give you an example in the template code. Yours should look exactly the same, except that you may have different inputs in the “shortcut” section.

To my understanding, input for the BatchNorm will be from Conv2D layer in the shortcut path.
So, I have provided X_shortcut calculated from the previous layer (Conv2D) to the BatchNorm layer. Is this not correct? :slightly_frowning_face:

Yes, that sounds correct. But I was more worried about the “axis” parameter.

Okay, for axis i am using the 3 for channels as the feature axis.
Solved it just now. I was using the wrong stride for the third component of the main path. Feeling silly now :smiley:
Thanks for your help!

1 Like

It’s great that you were able to find the solution! Thanks for confirming.