Closed ChasionNo1 closed 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.
To solve this problem, you can alternatively use CrossEntropyLoss by uncommenting Lines 91 and 104 and commenting Line 105 in train_UGformerV2.py.
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.