Course 4 Week 2 Exercise 3 - ResNet50 - General question - One - hot - vector

Hi everyone,
I have a question regarding the step that we have taken in the image classification for the SIGNS dataset.
I have noticed that the signs were stored as label encoding in the database and by using “convert_to_one_hot()” method we converted them to one-hot-vectors.

Convert training and test labels to one hot matrices

Y_train = convert_to_one_hot(Y_train_orig, 6).T
Y_test = convert_to_one_hot(Y_test_orig, 6).T

I was wondering if someone could explain that why we have done so? was it necessary or it was just optional and the label encoding could do the same?
If it was essential, would that mean for all the classifications in Tensorflow we have to convert the labels into one hot vector?

I really appreciate your help and time.
Thanks

The purpose of one hot representation is that it makes the values easy to use in matrix multiply calculations. Of course one hot representations are a lot more costly in terms of memory space, so you only do the conversion to one hot when you need to. For static storage, leaving the data as label values is more efficient.

So in other words, which representation you use at a given point all depends on what you are going to be doing with the data.

Thank you for the explanation.