Hi,
For one of my studies I want to dynamically register and unregister a pytorch forward hook. For example, I only need to access the activation outputs at certain steps. I have created a handle for the forward hook:
handle_1 = model.fc_1.register_forward_hook(act_hook())
Now if I remove the handle using:
handle_1.remove()
Is there anyway I can re-attach it somehow? Thanks in advance!