daiquocnguyen / Graph-Transformer

Universal Graph Transformer Self-Attention Networks (TheWebConf WWW 2022) (Pytorch and Tensorflow)
Apache License 2.0
652 stars 79 forks source link

Error while running "train_UGformerV2.py" #10

Closed ChasionNo1 closed 3 years ago

ChasionNo1 commented 3 years ago

The error message is as follows:

Traceback (most recent call last): File "D:/graph_code/Graph-Transformer-master/UGformerV2_PyTorch/train_UGformerV2.py", line 144, in train_loss = train() File "D:/graph_code/Graph-Transformer-master/UGformerV2_PyTorch/train_UGformerV2.py", line 101, in train graph_label = label_smoothing(graph_label, num_classes) File "D:\graph_code\Graph-Transformer-master\UGformerV2_PyTorch\UGformerV2.py", line 102, in label_smoothing truedist.scatter(1, truelabels.data.unsqueeze(1), confidence) IndexError: scatter(): Expected dtype int64 for index.

And my pytorch version is 1.7.0. How can I solve this problem, thanks for your answer.

daiquocnguyen commented 3 years ago

To solve this problem, you can alternatively use CrossEntropyLoss by uncommenting Lines 91 and 104 and commenting Line 105 in train_UGformerV2.py.