Hi,
I’m afraid this is expected.
Your original forward is only a matmul (the most optimized op we have) and you add 3 more operations.
You’ll get better performances if you use indices and index_select/index_copy or gather/scatter if the number of indices is small.