Compute_cost in course 2 week 3 tensorflow introduction

That probably means there is a bug in your one_hot_matrix function. Please show us the complete exception trace that you are getting when you run that cell that calls “map” on one_hot_matrix.

If this is the error you get:

ValueError: Shape must be rank 1 but is rank 0 for '{{node Reshape}} = Reshape[T=DT_FLOAT, Tshape=DT_INT32](one_hot_1, Reshape/shape)' with input shapes: [6], [].

Then please have a look at this other thread for the solution.

1 Like