Course 4 Week 1 Assignment 1:
‘conv_forward_test not defined’, ‘pool_forward_test’ is not defined
I’ve deleted all my Python files, I’ve deleted my ipynb file.
I’ve also tried rebooting the server. I’ve also tried changing the name of the ipynb file.
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-8-182241fd5e53> in <module>
11 print("cache_conv[0][1][2][3] =\n", cache_conv[0][1][2][3])
12
---> 13 conv_forward_test(conv_forward)
NameError: name 'conv_forward_test' is not defined
Right, the error means those tests are not found, usually those tests are in a utils file which you can check by going in File->Open in the Jupyter lab!
I am surprised how come they are not there if you have reset the Lab. Make sure that the file is there by going there and see inside the file, those functions-tests are there?
If they are not there, let me know I will tag someone from the QA team to have a look at it because I don’t have access to this course myself!
If you are running the labs locally (which is not recommended BTW), then you need to download all the files, not just the notebook. There is a topic about that on the DLS FAQ Thread.
If you have this problem on the course website, then it just means you did not run all the previous cells in the notebook. You need to do that everytime you open or restart the notebook. Click “Cell → Run All Above” and then run your test cell again. Notice that the “import” commands happen in the very first executable cell early in the notebook. The tests are imported from the file public_tests.py.
Also note that you filed this question under a generic category, but we can see by looking at the content that you are talking about DLS C4 W1 A1. I moved the thread for you by using the little “edit pencil” on the title. You’ll have better luck getting timely answers if you file your threads in an appropriate category, so that you get the attention of people who are familiar with the course you are working on. There are lots of different courses here now and more being added all the time, so it’s sometimes hard to tell what someone is asking about.
“Click “Cell → Run All Above” and then run your test cell again. The tests are imported from the file public_tests.py.”
I did it in the above way, Despite proceeding according to the above method, the conv_forward_test function and pool_forward_test function of public_tests.py. cannot be called. The same problem as before.
The rules do not allow to post code solutions publicly. However, as far as I saw all the tests did pass, you had no errors in these images, what is the issue?
So it looks like everything runs in the notebook if you just click “Cell → Run All”, but it only fails if you do “Validate” or submit to the grader. I have never seen that situation happen, so I don’t really have a theory other than that there must be something that got changed in the metadata in your notebook that is causing this. One way that could happen is if you downloaded the notebook and worked on it with different tools and then re-uploaded it back to the Coursera website.
One thing to try is to get fresh copies of the notebook and the public_tests.py file. Rename your notebook to save your code and delete the public_tests.py file and all the other “dot py” files that you see in the assignment. Then do the “Get Latest Version” procedure: just click “?” or “Help” in the upper right and then “Get Latest Version” as described on this thread.
Then carefully “copy/paste” over your completed code to the fresh clean copy of the notebook and try again.
Please let us know if that helps or not. If that doesn’t help, then I’m out of ideas and we’ll need to call in the course staff to look.
I agree with Paul, most likely the cell in the notebook that imports the unit tests has its metadata modified, such that the grader cannot import it.
Or the cell that calls the unit test had its metadata modified such that is is considered a graded cell. This would cause the grader to run the unit test code (normally it would not do this).
Essentially, the grader usually ignores the unit tests in the notebook, because it provides its own tests. Something about your notebook is defeating the design of the grader.
This can be caused by running the notebook on other platforms than Coursera Labs (for example, VSCode or Colab).
I will tell you the photos and contents of what I understood and acted on.
I downloaded Convolution_model_Step_by_Step_v1.ipynb and took it out.
In the first picture, I deleted files Convolution_model_Step_by_Step_v1.ipynb and public_tests.py.
You can see the deletion results in the second picture.
In the third picture, you can see that the 404 error occurs because the file has been erased,
You have received a new update by clicking on the question mark in the upper right corner.
You can see the newly updated Convolution_model_Step_by_Step_v1.ipynb and public_tests.py in the fourth picture.
When I first downloaded Convolution_model_Step_by_Step_v1.ipynb, I uploaded it to Google colab, finished copying the code to coursera jupyter, and scored it,
Unfortunately, I still can’t find the function in the public_tests.py file and I get zero points.
Did I make a mistake?