I see. I ran the code until convergence, and the final perplexity is almost the same as with the original function (as expected), so I don’t mind this all that much. It would have been nice to have the same numbers, though.