hi, I’m getting this error during one hot encoding
{Moderator’s Edit : Solution Code Removed}
AssertionError: Wrong output. Use tf.one_hot
how to rectify this
hi, I’m getting this error during one hot encoding
{Moderator’s Edit : Solution Code Removed}
AssertionError: Wrong output. Use tf.one_hot
how to rectify this
Hey @VISHNU_K_MENON,
In the output and the in the assertion, you can clearly see that the dimensions of your output and the expected output differ. The expected output is supposed to have dimensions (4, )
, while your output has dimensions (4, 1)
.
Additionally, in the one_hot_matrix
function, it is mentioned that the output is supposed to be a single-column matrix with the one hot encoding. So, all you need is a little modification in the shape of the tensor. Try this out, and if it doesn’t help, do let me know and I will let you know the solution.
P.S. - Posting code publicly is against the community guidelines. If any mentor needs to take a look at your code, he/she will ask you to DM the code to him/her.
Regards,
Elemento
thank you very much for the valuable advice @Elemento . I have corrected the error