I’m unable to complete the assignment because of a failure in the provided code.
Exercise 3 - one_hot_matrix passes all tests but an error occurs: "NameError: name 'new_y_test' is not defined"
This causes a failure later when computing the cost function.
Any ideas?
Thank you!
EDIT:
I have closed down my browser, reopend the lab, and rerun all sections. I still get this error.
Where is new_y_test defined? Did the cell throw an error? Run it again. Then add a cell right after that to print the value or the shape or anything to reference that variable. What happens?
Looking at the code, this probably means there is a bug in your one_hot_matrix routine. E.g. you hardcoded the dimension value or the like.
No, that’s the point: (depth,) is not the same thing as (depth). Try it and see.
When you do it your way, you pass the unit test for one_hot_matrix, but the cell that creates new_y_test throws the following error:
ValueError: Shape must be rank 1 but is rank 0 for '{{node Reshape}} = Reshape[T=DT_FLOAT, Tshape=DT_INT32](one_hot, Reshape/shape)' with input shapes: [6], [].
That is why new_y_test is not defined: the cell that creates it threw an error. Did you not see that when you looked before?
Mind you, I think you can legitimately claim that the unit test for one_hot_matrix is broken if it passes incorrect code. I’ll take a look at why that happens and file a bug if I can see how to fix it.