C2_W3 one_hot - tests successfully but failed to evaluate "y_test"

Hi all,

i am faceing some issues with the function “one_hot_matrix” in
TensorFlow Introduction | Coursera.

I am able to implement the function and to pass all tests but the evaluation of of “new_y_test = y_test.map(one_hot_matrix)” gets me the following error and i don’t know how to solve this.

“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], .”

Hi @Kugli96

Make sure the paramteres that are being passed to the functions and intermediate results are defined correctly by printing their values, shapes, etc.

Also, ensure that the shapes of tensors used in operations like tf.reshape or tf.one_hot are compatible.

Please see this thread. There is another post a bit further on that thread which goes into a bit more detail …

1 Like