Thanks for running the code and reporting this, and sorry it took me so long to reply. You're right: the printouts in the batched section came from an earlier run with different sentences, so they didn't match the code in the article. The code itself works; only the printed outputs were wrong. Your values are what the code produces, and they match the notebook.
I've updated the article. The outputs are now text instead of screenshots, taken from the notebook:
eos_idx: tensor([ 7, 13, 19, 28, 37, 38])
eos_idx_expanded: tensor([ 0, 7, 13, 19, 28, 37, 38])
normalized_idx: tensor([19, 7, 13, 19, 9, 18, 19])
reps: tensor([7, 6, 6, 9, 9, 1])