Bug: `GCNConv` in `to_hetero` with single node type
See original GitHub issue🐛 Describe the bug
I just started using heterogeneous graphs, so far I have roughly 1 year experience with homogeneous graphs using your library. I have a graph with just 1 node type (“gene”) but multiple edge types between the nodes. My HeteroData object prints as follows:
HeteroData(
gene={
x=[16433, 93],
y=[16433],
train_mask=[16433],
test_mask=[16433],
val_mask=False
},
(gene, BioPlex30HCT116, gene)={ edge_index=[2, 95370] },
(gene, BioPlex30293T, gene)={ edge_index=[2, 156370] },
(gene, HuRI, gene)={ edge_index=[2, 74488] }
)
I convert my GCN-based model (that runs fine with a homogeneous Data object) using the to_hetero()
function.
I then pass my data into the model as follows:
out = model(data.x_dict, data.edge_index_dict)
where data
is the HeteroData Object described above.
However, I get an error and I think it is because it expects edge_weight
somewhere:
Traceback (most recent call last):
out = model(data.x_dict, data.edge_index_dict)
File "/home/fratajcz/anaconda3/envs/compat/lib/python3.7/site-packages/torch/fx/graph_module.py", line 308, in wrapped_call
return cls_call(self, *args, **kwargs)
File "/home/fratajcz/anaconda3/envs/compat/lib/python3.7/site-packages/torch/fx/graph_module.py", line 308, in wrapped_call
return cls_call(self, *args, **kwargs)
File "/home/fratajcz/anaconda3/envs/compat/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "<eval_with_key_1>", line 7, in forward
edge_weight__gene__BioPlex30HCT116__gene = edge_weight.get(('gene', 'BioPlex30HCT116', 'gene'))
AttributeError: 'NoneType' object has no attribute 'get'
Do I have to specify edge weights in heterogeneous graphs? The Documentation doesnt mention it. It is weird that the traceback does mention only torch packages and not torch_geometric.
Cheers and thanks, Florin
Environment
- PyG version: 2.0.1
- PyTorch version: 1.8.0
- OS: CentOS Linux 7
- Python version: 3.7
- CUDA/cuDNN version: irrelevant
- How you installed PyTorch and PyG (
conda
,pip
, source): conda - Any other relevant information (e.g., version of
torch-scatter
): torch_scatter: 2.0.8
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
Yes, you can only use
GCNConv
for passing messages to the same node type, e.g.:This is a limitation of
GCNConv
as it does not support bipartite message passing.Thanks, I did not get that.