Question of week3 programming exercise - Using One Hot Encodings question

The shape in the test case are both [1, 4], which conflicts with the previous line of code “shape[0] == depth”. It could only satisfy one statement, but not both. Is this a bug, or did I misunderstand?

This is correct if you implement one_hot_matrix. The shape of one hot vector is [depth,] since it is “column wise matrix” as described in this assignment.

Implement the function below to take one label and the total number of classes 𝐶, and return the one hot encoding in a column wise matrix. Use tf.one_hot() to do this, and tf.reshape() to reshape your one hot tensor!

Oh, cool! Thanks! I haven’t noticed that!