Week 1, Assignment 2: Problem with test cases

I needed to add the following code after creating the happy_model (sequential API) for the test cases to pass:

happy_model = happyModel() 
# The following line needed to be added
happy_model.build(input_shape=(None,64,64,3)) 
# Print a summary for each layer
for layer in summary(happy_model):
    print(layer)

My code was running, model was training OK but the test cases did not succeed till I made the change. Am I doing something wrong?

Which week of the course are you working on ?

Week 1, assignment 2.

The blank notebook already has the required code:

What error do you get if you don’t add happy_model.build(…)?

AttributeError: The layer has never been called and thus has no defined output shape.

Since I could not figure out how to change code in the coursera notebook environment, I added

model.build(input_shape=(None,64,64,3)) 
return model

In the happy_model function which made the test cases pass. This looks (and feels) rather bad but it makes the auto-grader happy so I ended up submitting like this.

Are you using Coursera Labs, or are you running the code in some other environment?

Because there’s no need to add model.build().

Using coursera lab. Try running the code in lab - you should get the error.

I have run the lab, and I don’t get any error. And I didn’t use model.build().

Please download your ipynb notebook file and send it to me attached to a private message.