Sorry, I omitted the from link path (text/tutorials/transformer)
And the original timing of the tutorial implementation is:
timeit pos_encoding = positional_encoding(n, d)
17.8 ms ± 582 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)