Course 4, Week 4, Assignment 1, Exercise 3

The grader gives me a 66% with the following error:

Code Cell UNQ_C3: Unexpected error (TypeError("’>’ not supported between instances of ‘NoneType’ and ‘float’")) occurred during function check. We expected function who_is_it to return compute_layer_style_cost test 1 failed. Please check that this function is defined properly.
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.

The unit test passes with all the assert statements passing. Is it an issue with the grader?

My guess is that this is a problem with your code, although maybe the grader is not reporting it as accurately as it could. But it’s better than the usual “the test may be hidden” message. Anytime you see it complain about “Nonetype”, that usually means you neglected to fill in some code that you were supposed to. Search your notebook for instances of “None”. Maybe it’s not in the actual UNQ_C3 cell.

@paulinpaloalto, I have checked for any None’s with a ctrl+f and I haven’t missed any. I’ve done some basic debugging and find that on the third test my dist gets set to 0.0. There are no objects with Nonetype in my code when running the unit tests.

The output i get from cell 3 is:

it’s younes, the distance is 0.5992949
it’s younes, the distance is 0.5992949
it’s younes, the distance is 0.0

whereas the expected output is:

|it’s Younes, the distance is 0.5992946|(0.5992946, ‘younes’)|

I had distance being calculated by taking the L2 of the simple python difference between the encodings using ‘-’ but have switched it to tf.subtract(,) and its still producing the same results.

Here are my results from that section:

it's younes, the distance is tf.Tensor(0.5992949, shape=(), dtype=float32)
it's younes, the distance is tf.Tensor(0.5992949, shape=(), dtype=float32)
it's younes, the distance is tf.Tensor(0.0, shape=(), dtype=float32)

The values are the same but notice that my results are Tensors.

I’ve done the experiment both ways and the grader accepts either “all numpy” (- or np.subtract and np.linalg.norm) or “all TF” (tf.subtract and tf.norm) when you compute the distance.

One other thing to note is that the way the graders work here in Course 4 is a bit different than in C1 and C2: they don’t automatically do a “Save” for you, so you have to be careful to remember to do that anytime you change anything and before you hit “Submit”. Otherwise the grader sees whatever the state of the notebook was the last time you hit “Save”.