Facing Error in Fixed Code Section of TensorFlow Assignment - Need Help

Hi everyone,

I’m working through the TensorFlow Introduction Lab for my assignment. While I am getting successful outputs for most of the code, there is one fixed section of code (which I can’t modify) that is throwing an error.

Here are the steps I’ve taken to troubleshoot:

Rebooted the server
Updated to the latest version of TensorFlow
Tried running it in Cognito mode
However, none of these steps have resolved the issue. Has anyone encountered a similar problem? Any guidance would be appreciated!

When a cell that runs a test case throws errors, it means there are defects in the code you added to the function being tested.

In this case, your code for forward_propagation() has errors.

But that code is fixed I can’t change it

It’s your code in Section 3.1, Exercise 5 “forward_propagation” that has defects.

1 Like

Tom’s point is that the whole purpose of that cell is to test your forward_propagation function, which it does by calling it, although you don’t see the call directly in that code: it passes your function as an argument to the test function. You can examine the source code for the test function by clicking “File → Open” and then opening the file public_tests.py.

The larger moral of the story here is “If the test fails, the solution is not to change the test”. The solution is to figure out why your code fails the test. :nerd_face:

The first step is to read the error output carefully and understand what it is telling you. That failing assertion is checking that the shape of the return value of your function is (6,2), which is what it should be given the shapes of the inputs from the particular test case they are using. So what shape is your output? You can put a print statement right before the return or write your own test cell to find out. Then once you see what the wrong value is, the question is how it got that way.

Update: Actually you can see the shape in the output image you showed: your Z3 has one extra dimension and comes out with shape (1,6,2). So how did that happen?

Got it let me work on it Thanks

1 Like