Course 4 week 2 convolutional block

I am facing an assertion error “Wrong values when training=True” by running my code for the convolutional block, I’ve gone through similar topics on this and haven’t been able to resolve the issue. attaching the error message

1 Like

Please click my name and message your notebook as an attachment.

Please fix your mistake in shortcut path. This involves applying both the conv and batch norm operations to X_shortcut.

yup that fixed the issue with the code, but I dont understand why it matters, since initially x_shortcut is x.

1 Like

So you used x instead of x_shortcut for shortcut path?

1 Like

yup

1 Like

When X gets reassigned, X_shortcut holds reference to the previous value of X. Look at the diagram again with this detail in mind to better understand the shortcut path.

1 Like

The point is that the way we are writing the code the contents of x keeps changing in each layer, right? Each of the previous lines takes x as an input, changes it and reassigns it to x as the output of that line. Take a look at the diagram for how the shortcut layer works. The whole purpose of it is to feed the original value of x to that point in the compute graph.

1 Like

ok yea makes sense. it is the x from before.

1 Like