It seems to work using this small example:
act_in = {}
act_out = {}
def get_hook(name):
    def hook(m, input, output):
        act_in[name] = input[0].detach()
        act_out[name] = output.detach()
    return hook
        

model = nn.Sequential(
    nn.Conv2d(3, 6, 3, 1, 1),
    nn.ReLU(),
    nn.Flatten(),
    nn.Linear(6*24*24, 10),
    nn.ReLU(),
    nn.Linear(10, 10)
)

for name, module in model.named_children():
    module.register_forward_hook(get_hook(name))

x = torch.randn(1, 3, 24, 24)
out = model(x)

keys = list(act_in.keys())
for key_out, key_in in zip(keys[:-1], keys[1:]):
    print('Comparing output of {} to input of {}'.format(key_out, key_in))
    print((act_out[key_out] == act_in[key_in]).all())

> Comparing output of 0 to input of 1
tensor(True)
Comparing output of 1 to input of 2
tensor(True)
Comparing output of 2 to input of 3
tensor(True)
Comparing output of 3 to input of 4
tensor(True)
Comparing output of 4 to input of 5
tensor(True)

Feel free to post an executable code snippet to reproduce this issue.