megengine.module.Linear.register_forward_pre_hook

Linear.register_forward_pre_hook(hook)

Registers a hook to handle forward inputs. hook should be a function.

参数

hook (Callable) – a function that receive module and inputs, then return a modified inputs or None.

返回类型

HookHandler

返回

a handler with remove interface to delete the hook.