pyg-team / pytorch_geometric

Graph Neural Network Library for PyTorch
https://pyg.org
MIT License
21.23k stars 3.64k forks source link

TypeError: '>' not supported between instances of 'tuple' and 'int' #7467

Closed OswaldoBornemann closed 1 year ago

OswaldoBornemann commented 1 year ago

I tried to implement GCN to heterogenous node classification, the network i defined is below:

self.convs = torch.nn.ModuleList()

for _ in range(2):
    conv = HeteroConv({
        edge_type: GCNConv((-1, -1), hidden_dim)
        for edge_type in metadata[1]
    })
    self.convs.append(conv)

self.lin = Linear(hidden_dim, num_classes)

However, i got the error below:

File "/home/anaconda3/envs/graph/lib/python3.8/site-packages/torch_geometric/nn/dense/linear.py", line 95, in __init__
    if in_channels > 0:
TypeError: '>' not supported between instances of 'tuple' and 'int'
rusty1s commented 1 year ago

GCNConv does not support bipartite message passing, and so you can only use it for edge types that share the same source and destination node type.