awslabs / dgl-lifesci

Python package for graph neural networks in chemistry and biology
Apache License 2.0
696 stars 144 forks source link

Fix residual for gcn layer #216

Closed astolman closed 1 year ago

astolman commented 1 year ago

This makes the residual option for GCN layers compatible with dgl blocks with different numbers of src and dst nodes. Without this change, if a bipartite block was used in the forward function with fewer dst nodes than src nodes, an error would be thrown on addition because of the mismatched shapes. This makes it so that activation is only applied on the same number of rows as the GNN layer's output.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

mufeili commented 1 year ago

Hi @astolman , thanks for opening the PR. DGL-LifeSci currently focuses on small graphs and does not aim at handling dgl blocks.

astolman commented 1 year ago

Hi @astolman , thanks for opening the PR. DGL-LifeSci currently focuses on small graphs and does not aim at handling dgl blocks.

Are you saying you won't accept this PR then? I understand not wanting to spend efforts for large graphs, but this seems to be harmless for existing use cases and lets me keep using dgl-lifesci. Otherwise, I'm going to have to drop this dependency and write the models myself.

mufeili commented 1 year ago

I think it's easier if you simply copy and modify the code on your part, as you may also need to touch other models. Thanks for your understanding.