There is the following issue on this page: https://docs.pytorch.org/tutorials/intermediate/char_rnn_classification_tutorial.html
I think that comment "#Cache the tensor representation of the labels" is a little confusing, especially for those who are just learning PyTorch, because you are just creating numerical representation of unique labels in alphabetical order, while calculating tensor representation of each label on every iteration of data.