I’m sorry, but it’s a know problems with hooks right now. They only work properly on modules that create only a single Function in their forward (i.e. all simple modules like Linear, Conv2d, but not containers or custom losses like that). Your expectations are correct, this is how they should work.
We’ll be rolling out some serious autograd refactors in the upcoming week or two, and it should be fixed afterwards.