C4W2E1 identity block

I am told that the dimensions of X and X_shortcut do not match. How could this happen?

The error message you posted does not say anything about X and X_shortcut.

This is the earlier part. Check line 42.

If those two exception segments are part of the same trace, then the error message is telling you that X_shortcut is (4,4,3) and X is (4,4,4). Which is the correct value? Why are they different?

Just as a side note here, you may want to consider reversing the order on that Add: it’s got nothing to do with your problem here, but it may save you trouble later. Please see this thread for more explanation.

Thanks for the reply. As I debugged, the code runs well in either order for the add function.

Yes, it turns out I was thinking of the convolutional_block for that problem. And there the “Add” is part of the template code that they give you. But if you reverse the order of the Add there, it fails the “layer compare” test for the final ResNet because the layers are printed in a different order. Try it and see!

1 Like