Recently, I git cloned a GNN network and am trying to get the output from all the layers (as I am not sure what each layer are named).
There is a file in the GitHub repo that does the prediction by loading a pre-trained model with an example input i.e. pretrained.py and I am trying to add some additional code in it to extract outputs.
I have tried adding the following code just after the model.eval() in the above-mentioned file that was mentioned in other threads (which was used to extract intermediate layer output from loaded CNN models):
activation = {}
def get_activation(name):
    def hook(model, input, output):
        activation[name] = output.detach()
    return hook

for name, layer in model.named_modules():
    layer.register_forward_hook(get_activation(name))

But I am getting the following error:
Traceback (most recent call last):
  File "alignn/pretrained.py", line 248, in <module>
    out_data = get_prediction(
  File "alignn/pretrained.py", line 221, in get_prediction
    model([g.to(device), lg.to(device)])
  File "/home/vgf3011/.virtualenvs/alignn/lib64/python3.8/site-packages/torch/nn/modules/module.py", line 1120, in _call_impl
    result = forward_call(*input, **kwargs)
  File "/home/vgf3011/vishu/alignn/alignn/models/alignn.py", line 290, in forward
    x, y, z = alignn_layer(g, lg, x, y, z)
  File "/home/vgf3011/.virtualenvs/alignn/lib64/python3.8/site-packages/torch/nn/modules/module.py", line 1120, in _call_impl
    result = forward_call(*input, **kwargs)
  File "/home/vgf3011/vishu/alignn/alignn/models/alignn.py", line 163, in forward
    x, m = self.node_update(g, x, y)
  File "/home/vgf3011/.virtualenvs/alignn/lib64/python3.8/site-packages/torch/nn/modules/module.py", line 1123, in _call_impl
    hook_result = hook(self, input, result)
  File "alignn/pretrained.py", line 168, in hook
    activation[name] = output.detach()
AttributeError: 'tuple' object has no attribute 'detach'

Is there anything that I am doing wrong or do I have to be more specific on things to extract output from each of the layers?