Description:
I am getting the following error when running the test two_layer_model_test(two_layer_model)
Out of the 4 test cases, 3 pass and 1 fails.
I have checked my code, but I still cannot find what is causing this datatype mismatch.
This is part of the Programming Assignment: Deep Neural Network – Application.
Could someone please help me identify and fix the issue?
You can examine the code for the tests by clicking “File → Open” and then opening the file public_tests.py. But perhaps we can make progress here without resorting to that. What are the return values of two_layer_model? Here’s the return statement from the code that was given to you:
return parameters, costs
What are the types of those values?
parameters is a python dictionary containing all the W and b values, all of which are numpy arrays, right?
costs is a python list of the individual cost values.
I added some print statements in my code right before the return statement and here’s what I see when I run that test cell:
type(parameters) <class 'dict'>
type(costs) <class 'list'>
len(costs) 1
type(costs[0]) <class 'numpy.ndarray'>
Cost after first iteration: 0.693049735659989
What do you see if you do that?
But the cost value is just the return value from the compute_cost function, right? And they gave you that function. Ah, ok, here’s a theory: did you “hand import” your functions from the “Step by Step” assignment? If so, that is a mistake. They gave you that code as an import and in some cases it may work slightly differently than the functions we built in the previous exercise.
1 Like
Thanks sir, the problem is fixed.
1 Like