Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ValueError: MessagePassing.propagate only supports torch.LongTensor of shape [2, num_messages] or torch_sparse.SparseTensor for argument edge_index. #53

Closed
TianyuFan0504 opened this issue Jul 24, 2022 · 1 comment

Comments

@TianyuFan0504
Copy link

Hi! Thanks for the amazing work and released code. They are really interesting.
When I run ./transferLearning_MoleculeNet_PPI/chem/pretrain_graphcl.py, the error occur.
When I print it, i got the value of edge_index, but it is a str "add" instead of a tensor. Can someone help me?
Traceback (most recent call last):
File "pretrain_graphcl.py", line 185, in
main()
File "pretrain_graphcl.py", line 176, in main
train_acc, train_loss = train(args, model, device, dataset, optimizer)
File "pretrain_graphcl.py", line 103, in train
x1 = model.forward_cl(batch1.x, batch1.edge_index, batch1.edge_attr, batch1.batch)
File "pretrain_graphcl.py", line 61, in forward_cl
x = self.gnn(x, edge_index, edge_attr)
File "/opt/anaconda3/envs/torch170/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/root/GSSL/Molecular/GraphCL/transferLearning_MoleculeNet_PPI/chem/model.py", line 277, in forward
h = self.gnns[layer](h_list[layer], edge_index, edge_attr)
File "/opt/anaconda3/envs/torch170/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/root/GSSL/Molecular/GraphCL/transferLearning_MoleculeNet_PPI/chem/model.py", line 55, in forward
return self.propagate(self.aggr, edge_index, x=x, edge_attr=edge_embeddings)
File "/opt/anaconda3/envs/torch170/lib/python3.7/site-packages/torch_geometric/nn/conv/message_passing.py", line 272, in propagate
size = self.check_input(edge_index, size)
File "/opt/anaconda3/envs/torch170/lib/python3.7/site-packages/torch_geometric/nn/conv/message_passing.py", line 158, in check_input
('MessagePassing.propagate only supports torch.LongTensor of '
ValueError: MessagePassing.propagate only supports torch.LongTensor of shape [2, num_messages] or torch_sparse.SparseTensor for argument edge_index.

@yyou1996
Copy link
Collaborator

Hi @TianyuFan0504,

Sorry for the late reply and I am not sure whether you resolve it. If not, I think this issue #13 should be helpful.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants