facebookresearch / kill-the-bits

Code for: "And the bit goes down: Revisiting the quantization of neural networks"
Other
636 stars 124 forks source link

How to use '_register_hooks'? #19

Closed yw155 closed 4 years ago

yw155 commented 4 years ago

Hi @pierrestock, I would like to ask you how to use the function '_register_hooks' in watcher.py. Could you provide some example codes? In addition, I notice that It may generate errors during saving a model as torch.save may not support the function 'fwd_hook'. Thank you.

pierrestock commented 4 years ago

Hi yw155,

Thanks for reaching out! The documentation about forward hooks for nn.Module can be found here.

Regarding the function _register_hooks you are referring to, it successively does the following:

An example of utilisation of this function is given here.

Hope this helps,

Pierre

yw155 commented 4 years ago

Thank you for your detailed illustration.