Error compiling code to grade assignment in Week 1 Module

I think the problem is that you must have rearranged the order of the cells in the notebook. Maybe it was by accident, but that’s a big mistake. Here’s what those cells look like in a clean copy of the notebook:

How did that happen?

The best way to get things back to normal would be to do the “Restore Original Version” process documented on this thread. That’s the version for the Coursera Platform. The instructions are different if you are on the DeepLearning.AI platform: see this thread instead.

Or you can just try moving the “summary” cell to be after the cell that defines “model” again. Your choice. But if you’ve accidentally made one change like that, there may be others, so starting fresh might be the safer choice.