github.com
  
  
    pytorch/pytorch/blob/ffdecc1ac48baf6aea3848e9f530256342a7046b/torch/nn/modules/module.py#L1009 2

            tracing_state.push_scope(name)
        else:
            recording_scopes = False
    try:
        result = self.forward(*input, **kwargs)
    finally:
        if recording_scopes:
            tracing_state.pop_scope()
    return result

def _call_impl(self, *input, **kwargs):
    forward_call = (self._slow_forward if torch._C._get_tracing_state() else self.forward)
    # If we don't have any hooks, we want to skip the rest of the logic in
    # this function, and just call forward.
    if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
            or _global_forward_hooks or _global_forward_pre_hooks):
        return forward_call(*input, **kwargs)
    # Do not call functions when jit is used
    full_backward_hooks, non_full_backward_hooks = [], []
    if self._backward_hooks or _global_backward_hooks:
        full_backward_hooks, non_full_backward_hooks = self._get_backward_hooks()



  
  
    
    
  
  


Check the source code of nn.Module.__call__(), where all the hooks are fired with forward().