ssp icon indicating copy to clipboard operation
ssp copied to clipboard

AttributeError: 'Linear' object has no attribute '_cached_edge_index'

Open ShenzhiYang2000 opened this issue 2 years ago • 7 comments

I met a problem that "AttributeError: 'Linear' object has no attribute '_cached_edge_index'" when I run the code 'gcn.py' at the time I set "--preconditioner = KFAC". I will appreciate it if anyone could help me.

ShenzhiYang2000 avatar Oct 23 '22 11:10 ShenzhiYang2000

I met a problem that "AttributeError: 'Linear' object has no attribute '_cached_edge_index'" when I run the code 'gcn.py' at the time I set "--preconditioner = KFAC". I will appreciate it if anyone could help me.

I got the same problem. Authors of this repo might help us.

abose17 avatar Nov 21 '22 18:11 abose17

I tried some ways to fix this error. But the result with KFAC is so pool! Just in init function of KFAC

for sub_mod in mod.modules(): if hasattr(sub_mod, '_cached_edge_index'): print(f"+register_backward_hook _cached_edge_index@{sub_mod}") handle = sub_mod.register_backward_hook(self._save_grad_output) self._bwd_handles.append(handle)

closest-git avatar Dec 05 '22 09:12 closest-git

I think I managed to fix the error. #3 to reproduce the result of the paper use this command. -> python gcn.py --dataset=Cora --split=complete --optimizer=Adam --preconditioner=KFAC --eps 0.21544346900318823 --logger=test --hidden 64

Ldoun avatar Jan 28 '23 05:01 Ldoun

I think I managed to fix the error. #3 to reproduce the result of the paper use this command. -> python gcn.py --dataset=Cora --split=complete --optimizer=Adam --preconditioner=KFAC --eps 0.21544346900318823 --logger=test --hidden 64

I meet another error when I use this command: AttributeError: 'KFAC' object has no attribute '_fwd_handles' Do you have any idea why it happened?

xbingsun avatar Feb 10 '23 08:02 xbingsun

I met a problem that "AttributeError: 'Linear' object has no attribute '_cached_edge_index'" when I run the code 'gcn.py' at the time I set "--preconditioner = KFAC". I will appreciate it if anyone could help me.

zzzsh2000 avatar Apr 26 '23 02:04 zzzsh2000

I met a problem that "AttributeError: 'Linear' object has no attribute '_cached_edge_index'" when I run the code 'gcn.py' at the time I set "--preconditioner = KFAC". I will appreciate it if anyone could help me.

for me, the error occurred due to torch_geometric version. one simple solution might be downgrading the torch_geometric. or you could just copy the gcn layer code from the previous torch_geometric like I did #3

Ldoun avatar Apr 26 '23 05:04 Ldoun

I meet another error when I use this command: AttributeError: 'KFAC' object has no attribute '_fwd_handles' Do you have any idea why it happened?

hmmm not sure, I don't think I met that error. maybe downgrading the torch_geometric and rerunning with the original code might work.

Ldoun avatar Apr 26 '23 05:04 Ldoun