Hi there, I see that you are using my silly hack solution haha:)
Please take a look at NN Module functional API · Issue #49171 · pytorch/pytorch · GitHub 5
which shall provide an elegant solution after 1.11 release.