I’m unable to enter breakpoints (using PyCharm) inside my hook functions, e.g.:
class MyModule(nn.Module):
    def __init__(self, train: bool):
        super().__init__()
        
        def hook(module, grad_input, grad_output):
            print('hello there')
        self.register_backward_hook(hook)

I cannot break on the print but it will still execute. Does anyone know why that is and if there is a possible way to circumvent this?