pyg-team / pytorch_geometric

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

Pass edge weights/attributes to GraphUNet #9736

Closed eurunuela closed 4 weeks ago

eurunuela commented 1 month ago

🚀 The feature, motivation and pitch

I noticed that the GraphUNet model doesn't make use of the edge attributes that I have calculated. I find it very odd that the model uses ones as the starting weights, as opposed to having the option to pass predefined weights to better inform the model on an initial pass.

Alternatives

No response

Additional context

No response

eurunuela commented 1 month ago

I have tried adding the functionality on a local branch, but I keep getting this error:

  File "/home/eneko/GitHub/tmima/tmima/training/model.py", line 108, in forward
    x = self.down_convs[0](x, edge_index, edge_weight)
  File "/home/eneko/GitHub/tmima/tmima/training/model.py", line 117, in torch_dynamo_resume_in_forward_at_108
    edge_index, edge_weight = self.augment_adj(edge_index, edge_weight, x.size(0))
  File "/home/eneko/GitHub/tmima/tmima/training/model.py", line 149, in augment_adj
    edge_index, edge_weight = remove_self_loops(edge_index, edge_weight)
  File "/home/eneko/GitHub/tmima/tmima/training/model.py", line 151, in torch_dynamo_resume_in_augment_adj_at_149
    adj = to_torch_csr_tensor(edge_index, edge_weight, size=(num_nodes, num_nodes))
  File "/home/eneko/GitHub/tmima/tmima/training/model.py", line 152, in torch_dynamo_resume_in_augment_adj_at_151
    adj = (adj @ adj).to_sparse_coo()
RuntimeError: expand is unsupported for SparseCsr tensors