There is an assertion error in the Week 3 programming assignment, precisely in Exercise 4.
Here’s the error:
AssertionError Traceback (most recent call last)
in
----> 1 w3_unittest.test_forward_propagation(forward_propagation)
~/work/w3_unittest.py in test_forward_propagation(target_forward_propagation)
289
290 for test_case in test_cases:
→ 291 result = target_forward_propagation(
292 test_case[“input”][“X”],
293 test_case[“input”][“parameters”],
in forward_propagation(X, parameters, n_y)
22 ### END CODE HERE ###
23
—> 24 assert(Y_hat.shape == (n_y, X.shape[1]))
25
26 return Y_hat
Please include the error message when posting your query, not a link to your assignment. The community members in general can not access your workspace.
The AssertionError is raised because the shape of Y_hat is not as expected. You can check you code by printing the shape of X and the value of n_y to trace where in the code has gone wrong.
Here is an example of a print statement to print the shape of X:
print('shape of X: ', X.shape())
The best way to be sure is to print the shape of y_hat.
The print statement shown here is in the same block level as the if statement, so ‘True’ is the output. In order to do want you wanted, you need to indent one block level to the right, so that the print statement is within the logic of the if statement.
Also, don’t forget to clear all the output and rerun the code cell from the beginning of the notebook.