Thanks for the clarification. I missed this output.
The layer itself is never called, but its parameters are used in F.multi_head_attention_forward in these lines on code 7, which is why the hook isn’t called.