2.3 - Using One Hot Encodings question

Dear friends,

I am not following here. I thought the final output of one hot encoding is a matrix not a row. In other words, you give the the row input like [0 1 2 3 0 2 1], and you wish to have a matrix output.
my code is one_hot = tf.reshape( tf.one_hot(label, depth, axis=0), depth) give a row here, but passes all tests… but again, it gives me error in the

new_y_test = y_test.map(one_hot_matrix)
new_y_train = y_train.map(one_hot_matrix)

So, I think something is not right here even the tests are all passed.

Hello @sunson29,

I guess this is not one of the Machine Learning Specialization assignment, which specialization is it? i suggest you to move your thread to the right category, because it is better for mentors who have access to the assignment in question to answer your question. To move your thread, click the edit button (pencil icon) at the lower right corner of the first post in this thread. If you can’t move it, let us know so I or other mentors can help.


oh? I am talking about the hw of “Tensorflow_introduction” .

which specialization is it? Or what’s the name of the course?

Maybe I made a mistake. If yes, could you move my question to the right place? thank you!

I moved your thread to the Deep Learning Specialization category.