RuntimeError: register_forward_hook is not support on ScriptModules

How to deal : register_forward_hook is not support on ScriptModules

Or whether there are alternative solutions, Thanks.

That’s a known limitation and the feature request is tracked here so feel free to add your use case to the linked issue.