C3W3_Assignment Testing with your own questions

Hello, does anyone know what is incorrect in the predict function?

{moderator edit - solution code removed}

The instructions tell you to compute the cosine similarity, but all you’ve done is just the sum of the two vectors. That’s not the same thing, right?

And with a little more careful look, you’re not even implementing the sum correctly. TF “reduce_sum” takes a single tensor argument, right? It then sums across the specified axis (default “None”).


The below comment helped me correct

this code by @arvyzukai NLP mentor

you need to check v1v2 shape and then check his comment where it mention v1.shape and v2.shape, apply the value to the shape.



Thank you for your valuable feedback.

1 Like

Also what Paul caught another error in your code about cosine similarity when you tf.math_reduce_sum, you are suppose to use correct operator, and I think you must have used similar code in the previous grader cell classify.

1 Like