The code illustrates that the forward hook registered in model.fc returns the “pre-relu” activation, since negative values are shown. Since my code snippet creates two different modules, the parameters will also be randomly initialized. If you want to get the same output, you could load the state_dict of the first model into the second one:
x = torch.randn(1, 10)

# out of place
model = MyModel()
sd = model.state_dict()
model.fc.register_forward_hook(lambda m, input, output: print(output))
out = model(x)

# inplace
model = MyModel(inplace=True)
model.load_state_dict(sd)
model.fc.register_forward_hook(lambda m, input, output: print(output))
out = model(x)