Create a hook on `m` with `hook_func`.
Hook(
m,
hook_func,
is_forward = TRUE,
detach = TRUE,
cpu = FALSE,
gather = FALSE
)
m aprameter
hook function
is_forward or not
detach or not
cpu or not
gather or not
None
Hooks are functions you can attach to a particular layer in your model and that will be executed in the forward pass (for forward hooks) or backward pass (for backward hooks).