Course 2 Week 3 Tensorflow 2.3

In the one_hot_matrix assignment, my test cases are passing with the below equation,

one_hot = tf.reshape(tf.one_hot(label, depth, axis=0), depth)

but this error shows up for y_train and y_test,

This problem is solved by passing a tuple of depth into it.


1 Like

sorry, can you show your answer to this problem with an image? I have this problem too, but I can’t fix it.

We need to pass the shape as (depth, ) so the shape of the returned vector is of rank-1

thank you so much for your response.