No, not necessarily.
The number of samples does not correspond to the number of classes.
You can freely pick the former (number of samples), while the latter (number of classes) is defined by your use case.
E.g. if you want to train a model to predict 10 classes, the number of classes would be 10 and the output layer would return a tensor containing the logits for all these 10 classes.
Even if you are using a single sample, the corresponding class might be any value between 0 and 9, so the output shape should still be [batch_size, nb_classes, *] and the target can contain values in [0, 9].