PyTorch Hooks Explained - In-depth Tutorial
Elliot Waite
In this video, I explain how hooks work in PyTorch. Hooks allow you to inject code into different parts of the computational graphs (in both the forward graph and the backward graph). The four types of hooks that are available in PyTorch are: Tensor.register_hook (https://pytorch.org/docs/master/autograd.html?highlight=register#torch.Tensor.register_hook) Module.register_forward_pre_hook (https://pytorch.org/docs/master/generated/torch.nn.Module.html?highlight=register#torch.nn.Module.register_forward_pre_hook) Module.register_forward_hook (https://pytorch.org/docs/master/generated/torch.nn.Module.html?highlight=register#torch.nn.Module.register_forward_hook) Module.register_backward_hook (https://pytorch.org/docs/master/generated/torch.nn.Module.html?highlight=register#torch.nn.Module.register_backward_hook)
My previous video, "PyTorch Autograd Explained - In-depth Tutorial": š¼ https://youtu.be/MswxJw-8PvE
GitHub code examples of using hooks: š» https://github.com/elliotwaite/pytorch-hooks-tutorial
Join our Discord community: š¬ https://discord.gg/cdQhRgw
Connect with me: š¦ Twitter - https://twitter.com/elliotwaite š· Instagram - https://www.instagram.com/elliotwaite š± Facebook - https://www.facebook.com/elliotwaite š¼ LinkedIn - https://www.linkedin.com/in/elliotwaite
šµ Kazukii - Return ā https://soundcloud.com/ohthatkazuki ā https://open.spotify.com/artist/5d07MpiIaNmmEMTq79KAga ā https://www.youtube.com/user/OfficialKazuki ... https://www.youtube.com/watch?v=syLFCVYua6Q
77831239 Bytes