您好,打扰了。我在运行pytorch版本的GATNE代码时,总是在训练第二个epoch时出现以下错误:
epoch 0: 100%|| 7066/7066 [01:29<00:00, 78.82it/s]
Traceback (most recent call last):
File "src/main_pytorch.py", line 315, in
average_auc, average_f1, average_pr = train_model(training_data_by_type, feature_dic)
File "src/main_pytorch.py", line 250, in train_model
node_emb = model(train_inputs, train_types, node_neigh)
File "D:\software\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 550, in call
result = self.forward(*input, **kwargs)
File "src/main_pytorch.py", line 85, in forward
node_embed_neighbors = self.node_type_embeddings[node_neigh]
IndexError: tensors used as indices must be long, byte or bool tensors
请问这样的错误应该如何纠正?
应该是node_neigh的问题:
nodeneigh = torch.tensor(
[neighbors[i] for in range(edge_type_count)]
).to(device)
您好,打扰了。我在运行pytorch版本的GATNE代码时,总是在训练第二个epoch时出现以下错误: epoch 0: 100%|| 7066/7066 [01:29<00:00, 78.82it/s] Traceback (most recent call last): File "src/main_pytorch.py", line 315, in
average_auc, average_f1, average_pr = train_model(training_data_by_type, feature_dic)
File "src/main_pytorch.py", line 250, in train_model
node_emb = model(train_inputs, train_types, node_neigh)
File "D:\software\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 550, in call
result = self.forward(*input, **kwargs)
File "src/main_pytorch.py", line 85, in forward
node_embed_neighbors = self.node_type_embeddings[node_neigh]
IndexError: tensors used as indices must be long, byte or bool tensors
请问这样的错误应该如何纠正?
应该是node_neigh的问题: nodeneigh = torch.tensor( [neighbors[i] for in range(edge_type_count)] ).to(device)
但是我不太清楚node_neigh的是如何生成的,维数如何,可以麻烦您指点一下吗?谢谢!