Given the following code:
class Example(nn.Module):
  def __init__(self):
    super().__init__()
    self.l1 = nn.Linear(1,3)
    self.l2 = nn.Linear(3,2)
  
  def forward(self, x):
    mid = self.l1(x)
    res = self.l2(mid)
    return res

is there a way to have a hook the the mid variable in the forward call?
something like:
example.forward.mid.register_hook(lambda x: print(x))