megengine.module.Identity.register_forward_hook

Identity.register_forward_hook(hook)

Registers a hook to handle forward results. hook should be a function that receive module, inputs and outputs, then return a modified outputs or None.

This method return a handler with remove interface to delete the hook.

返回类型

HookHandler