One hot vector label in Week 4: Multi-class Classification

Hi
in the assignement of W4, they asked us to create a last softmax layer with 25 or 26 neurones to predict the class ( between 1 to 26) but the labels are just scalar , they are not vectors of shape(26,) to be used correctly in loss calclulation
so what can we do ?

I have not taken that course, so I don’t know what they say about this in the course materials or the assignment, but I believe you have two choices:

  1. There’s a TF function for that. Try googling “TF one hot”.
  2. Or they offer a number of versions of the cross entropy loss function and one of them can take the labels in “categorical” form. Google “TF sparse cross entropy”.