Silly question, but anyone see why the autograder is marking this as wrong? I’ve only screenshot my code output and the expected results. I think my output exactly matches the expected results, and I even did a line-by-line comparison in Excel. However, the autograder indicates that I have a wrong output for my weights and biases.
It looks like you succeeded on the test case that is shown in the notebook, but the one that fails is different. It’s in the file public_tests.py. Maybe you should take a look at that test case and see what is different about it. Perhaps you hard-coded something so that it works with one test, but not the other.
One other thing to check: did you use “-=” to do the updates? If so, that fails the test unless you “deepcopy” the inputs to break the connection to global variables. Here’s a thread which explains what is going on there. Note that they try to help you in the template code by doing a “flat” copy, but that is not enough with a dictionary: you need copy.deepcopy(). That is explained on the thread that I linked. Make sure to read all the way through the thread to get to this later post.
Thanks Paul! Good call on the copy/deepcopy. Thanks for the informative posts. Pointer vs copy of objects is definitely tricky in Python!