Week 2 Graded Practice Lab is having error

Week 2 - Graded Practice Lab is having error

I have completed the final practice lab on C2W2_Assignment (Week 2 - Neural Networks Training) but the system does not registered my answer for Question 2, even though:
(1) I did not change anything on the code block, except for adding my code on the designated section.
(2) I did not remove any code
(3) The code ran perfectly on the notebook and displayed “All tests passed!”
(4) I have tried everything: restarting kernel, restoring original version etc but the error still persists.

I just worked this exercise on the DLAI Learning Platform and didn’t have any trouble getting the full scores from the grader.

My guess is that there must be something about your solution to exercise 2 (the construction of the sequential model) that differs from what the grader expects, but somehow it can’t give you reasonable feedback. Maybe it’s time to look at your code. We can’t do that on a public thread, but please check your DMs for a message from me about how to proceed.

To close the loop on the public thread, it turns out that the issue was in Exercise 2, where we use the Sequential function to define the model. We need to specify the shape of the input using tf.keras.Input and they showed us how in the instructions:

tf.keras.Input(shape=(400,))

That code was just given to us, so it’s ok to show it here. If instead you rewrite that using X.shape to get the required dimension, it works in the notebook because X is a global variable that has already been defined if you run all the cells in the notebook in order. But it fails the grader if you write the code that way, because apparently the grader does not just run all the cells in your notebook in order and X was not defined. It remains a mystery why the grader couldn’t give a more helpful message in that case. :smiley:

1 Like