├── 1_tensor_hooks ├── 1_without_hooks.py ├── 2_with_hooks.py ├── 3_with_hooks_and_remove.py ├── 4_addition_instead_of_multiplication.py └── 5_hook_with_in_place_operation.py ├── 2_module_forward_hooks ├── 1_module_without_hooks.py ├── 2_module_with_hooks.py ├── 3_module_with_hooks_and_prints.py └── 4_remove_module_hooks.py ├── 3_module_backward_hooks ├── 1_working_module_backward_hook.py ├── 2_broken_module_backward_hook.py └── 3_tensor_hooks_workaround.py ├── LICENSE └── README.md /1_tensor_hooks/1_without_hooks.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwaite/pytorch-hooks-tutorial/HEAD/1_tensor_hooks/1_without_hooks.py -------------------------------------------------------------------------------- /1_tensor_hooks/2_with_hooks.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwaite/pytorch-hooks-tutorial/HEAD/1_tensor_hooks/2_with_hooks.py -------------------------------------------------------------------------------- /1_tensor_hooks/3_with_hooks_and_remove.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwaite/pytorch-hooks-tutorial/HEAD/1_tensor_hooks/3_with_hooks_and_remove.py -------------------------------------------------------------------------------- /1_tensor_hooks/4_addition_instead_of_multiplication.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwaite/pytorch-hooks-tutorial/HEAD/1_tensor_hooks/4_addition_instead_of_multiplication.py -------------------------------------------------------------------------------- /1_tensor_hooks/5_hook_with_in_place_operation.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwaite/pytorch-hooks-tutorial/HEAD/1_tensor_hooks/5_hook_with_in_place_operation.py -------------------------------------------------------------------------------- /2_module_forward_hooks/1_module_without_hooks.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwaite/pytorch-hooks-tutorial/HEAD/2_module_forward_hooks/1_module_without_hooks.py -------------------------------------------------------------------------------- /2_module_forward_hooks/2_module_with_hooks.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwaite/pytorch-hooks-tutorial/HEAD/2_module_forward_hooks/2_module_with_hooks.py -------------------------------------------------------------------------------- /2_module_forward_hooks/3_module_with_hooks_and_prints.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwaite/pytorch-hooks-tutorial/HEAD/2_module_forward_hooks/3_module_with_hooks_and_prints.py -------------------------------------------------------------------------------- /2_module_forward_hooks/4_remove_module_hooks.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwaite/pytorch-hooks-tutorial/HEAD/2_module_forward_hooks/4_remove_module_hooks.py -------------------------------------------------------------------------------- /3_module_backward_hooks/1_working_module_backward_hook.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwaite/pytorch-hooks-tutorial/HEAD/3_module_backward_hooks/1_working_module_backward_hook.py -------------------------------------------------------------------------------- /3_module_backward_hooks/2_broken_module_backward_hook.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwaite/pytorch-hooks-tutorial/HEAD/3_module_backward_hooks/2_broken_module_backward_hook.py -------------------------------------------------------------------------------- /3_module_backward_hooks/3_tensor_hooks_workaround.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwaite/pytorch-hooks-tutorial/HEAD/3_module_backward_hooks/3_tensor_hooks_workaround.py -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwaite/pytorch-hooks-tutorial/HEAD/LICENSE -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwaite/pytorch-hooks-tutorial/HEAD/README.md --------------------------------------------------------------------------------