Every classification loss takes labels as a matrix of zeros and ones, not as a list of class numbers. Writing the conversion once is how you learn what fancy indexing is for.
Write one_hot(labels, n_classes).
labels is a sequence of integers in [0, n_classes). Return a float array of shape (len(labels), n_classes) where row i has a 1.0 in column labels[i] and 0.0 everywhere else.
You have read the opening. The rest is free with a Bezen account, and no card is needed.
Behind the sign-in