Question about using to_hetero
and HeteroConv
with a MessagePassing
module that updates nodes and edges
#10249
Unanswered
thebookins
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a
MessagePassing
module (we'll call itEdgeUpdatingConv
) that on its forward pass updates nodes and edges, returning the tuplex, edge_attr
.Say I want to use this layer
num_layers
times, with the output of each layer fed into the next layer as input. Furthermore, I want to apply these layers to a heterogenous graph. According to https://pytorch-geometric.readthedocs.io/en/2.6.0/notes/heterogeneous.html this can be accomplished by applying theto_hetero
transformation to the module, or by usingHeteroConv
. However, bothto_hetero
andHeteroConv
assume that the MessagePassing convolutions return a single tensor representing the updated nodes.For example, the following code will fail at the aggregation step:
I have managed to get the right result by writing a custom
HeteroConv
class that expects each convolution to return updated nodes and edges (and the custom class itself returns a dictionary of updated nodes and a dictionary of updated edges).However, I'm curious if there is a better way of achieving this, or if it makes sense in the future for
to_hetero
andHeteroConv
to support edge-updating convolutions.Beta Was this translation helpful? Give feedback.
All reactions