Course 2 Week 3 assignment one hot function

I am stuck on this function. it says it is one line, but i dont know what to do with the tf.reshape(). I have this ‘one_hot = tf.one_hot(labels, C, axis=0)’ but it returns a list index error on the second test ‘result.sjape[1] == 1’ Please help. there not much information about one hot in v2.3 on google. been scouring forums all day.

nvm i figured it out. : }

Great to hear!
Yeah, one_hot is kinda confusing to get at first.

Hi, I was getting the same error ‘list index out of range’. Could you please explain how you resolved this error ?
Thank you


I fixed this. I hadn’t noticed that I hardcoded a few values in the one_hot function. I’ve fixed it. Thank you all!


Please how did you resolve this error, am getting same error.

1 Like

did you able to solve

hello did you solved that please tell me i am stuck at that point