From the “Error: Datatype mismatch” error, I’d guess that somewhere you’re using a float where it’s supposed to be a numpy array.
Exactly. Some of the outputs of your two_layer_model
function must be wrong. You can examine the test code by clicking “File → Open” and then opening the file public_tests.py
to try to understand which return value is wrong. But perhaps the easier thing is just to print the types of your return values and see if you notice anything odd about them.
print(f"type(parameters['W1']) = {type(parameters['W1'])}")
print(f"type(costs) = {type(costs)}")
print(f"len(costs) = {len(costs)}")
Here’s what I see when I do that after the simple test for two_layer_model
:
type(parameters['W1']) = <class 'numpy.ndarray'>
type(costs) = <class 'list'>
len(costs) = 1
Thank you, problem solved, I didn’t change anything, something wrong with the tester, today all tests passed
I’m glad to hear that everything works now, but my guess is that is not some kind of bug in the test code. Most likely it was a confusion on your part about the state of your notebook. Here’s a thread which explains some things about how the notebooks work that can cause that type of confusion.