Hi there,
Suppose we are using a forward hook to analyze a mid layer:
class Hook():
def __init__(self,m):
self.hook = m.register_forward_hook(self.hook_func)
def hook_func(self,m,i,o):
self.stored = o.detach().clone()
def remove():
self.hook.remove()
The Hook class is created for multiple cases. If I do not remove the hook after use, what negative effect will occur.
Thanks!