Forward pass hook which attaches backward pass hooks to intermediate tensors
(module, args, output)
| 143 | |
| 144 | def hook_forward(module_name, grads, hook_backward): |
| 145 | def hook(module, args, output): |
| 146 | """Forward pass hook which attaches backward pass hooks to intermediate tensors""" |
| 147 | output.register_hook(hook_backward(module_name, grads)) |
| 148 | return hook |
| 149 | |
| 150 | def hook_backward(module_name, grads): |
nothing calls this directly
no test coverage detected