Hi, @ptrblck, Actually, it is not correct. I have registered the same hook_fn on two modules.
model.enc_layers.self_attn.out_proj.register_forward_pre_hook(forward_pre_hook_fn)
model.enc_layers.linear1.register_forward_pre_hook(forward_pre_hook_fn)
What we are seeing is from the 2nd call, and the 1st one doesn’t work: we should see another print. Hope this makes clear.