C2 W1 Assignment Error "We expected variable model to be of type <class list>"

Hi Everyone,

I am at the end of Week 1- Neural Networks Lab in Advanced Learning Algorithms. I have corrected a few of the errors that I received regarding this code, early on. I decided to post the latest error to get some assistance with this issue:

Error received:

Unexpected error occurred during variable check. We expected variable `model` to be of type <class ‘list’>. Please check that this variable is initialized and is of the right type. Code Cell UNQ_C2: Function ‘my_dense’ is correct. If you see many functions being marked as incorrect, try to trace back your steps & identify if there is an incorrect function that is being used in other steps. This dependency may be the cause of the errors.

Code cell says:

# UNQ_C2

# GRADED FUNCTION: my_dense
    # mentor edit: code removed

I tried resetting the lab/notebook to start over. But that didn’t work either. This lab is preventing me from moving forward into next week’s module. Also, I get an error when I attempt to post this as a separate question using the AI DeepLearning tag, so I posted it here.

{mentor edit: image of code removed}

Please advise. Thanks so much.

Please do not share your code on the forum. That is not allowed by the Code of Conduct.

Posting screen capture images of your error messages, asserts, or test results is perfectly fine.

Problems with your notebook:

  • You have added a cell that contains a duplicate of the my_dense() fucntion, and added a sigmoid() function. Please delete this cell, it is not the correct solution, and can well be confusing the grader.

  • Adding a cell to a notebook is quite a bad idea. The notebook is set up so that you should only add code where it says “START CODE HERE”, and not touch anything else in the notebook.

You might need to delete your current notebook, then use the “?” Lab Help tool and then “Get latest version”. This will give you a clean copy of the notebook so you can start over.

Sorry to interrupt. Tensorflow developer professional certificate uses tensorflow 2.16 which relies on keras 3 Api.

Hello @DanielleRenee1

I have moved your post along with the replies to a new topic. Next time, to post your own topic, you may go here, then select the right course, then click “New Topic”, then add the tag for the right week, then you should be good to start a post.

I agree with Tom that we shouldn’t add any extra cell for the submission as it may interfere with the grader in unexpected way. Starting from a fresh notebook and only filling in the blanks for the exercises is the best idea to make sure no unaware and unexpected change was there.

I have also read the error message and it said “Cell UNQ_C2: Function ‘my_dense’ is correct.”, so it was suggesting that your exercise 2 was fine, so I would pay attention to the exercise 1 and make sure to implement it as instructed and, if needed, check out the hint collapsed below the exercise’s cell.

Good luck!
Raymond