Diego999 / pyGAT

Pytorch implementation of the Graph Attention Network model by Veličković et. al (2017, https://arxiv.org/abs/1710.10903)
MIT License
2.89k stars 689 forks source link

Assert Error #52

Open tanjia123456 opened 3 years ago

tanjia123456 commented 3 years ago

Hello, I use my own datasets, and sparseGAT. Now I have met an Assert Error in layers: Traceback (most recent call last): File "F:/googledownload/pyGAT-master/train_data.py", line 157, in <module> loss_values.append(train(epoch)) File "F:/googledownload/pyGAT-master/train_data.py", line 108, in train output=model(x_train[i], adj_index) File "D:\anaconda3.4\lib\site-packages\torch\nn\modules\module.py", line 550, in __call__ result = self.forward(*input, **kwargs) File "F:\googledownload\pyGAT-master\models_data.py", line 49, in forward x = torch.cat([att(x, adj) for att in self.attentions], dim=1) File "F:\googledownload\pyGAT-master\models_data.py", line 49, in <listcomp> x = torch.cat([att(x, adj) for att in self.attentions], dim=1) File "D:\anaconda3.4\lib\site-packages\torch\nn\modules\module.py", line 550, in __call__ result = self.forward(*input, **kwargs) File "F:\googledownload\pyGAT-master\layers_data.py", line 164, in forward assert not torch.isnan(h_prime).any() AssertionError

Maybe there is nan value, But I don't know how to solve it.

Yujun-Yan commented 3 years ago

I have the same problem with sparse GAT. Even stacking more layers in the cora/citeseer dataset will lead to this error. It seems nan is generated during the process

nxchenbnu commented 1 year ago

I suggest you read Layer.py carefully, especially in its adj/edge matrix/numpy. It may occur due to the wrong use of dataset.