Can we share weights between SageConv layers for same node_type in HeteroConv layer?

Hi, I have a doubt regarding the implementation of the HeteroConv layer.

As per my understanding HeteroConv layer takes different types of Callable layers (SageConv, GCNConv, etc). each layer has its own weight. Let’s say I want to create a HetroConv layer and want to use the SageConv layer for each relation. So as per the current implementation of SageConv and HeteroConv, each SageConv layer will have two weight matrices (I am using a linear layer for transformation before message passing) one for the neighbor and one for the root node. This will be followed for all SageConv layers.

So for the graph given below:

Author - writes - Paper => SageConv
Paper - cites - Paper => SageConv

we will have 1 weight matrices for paper in (Author - writes - Paper) and 2 weight matrices for Paper in (Paper - cites - Paper). In total 3 weight matrices for Paper. Why do we need 3 different weight matrices for a single node type? Can’t we share weight matrices ?

In short, can’t we share weight matrices between the same type of layers in HeteroConv? If we can then why aren’t we?

You should be able to achieve that with something below:

shared_conv = SAGEConv(...)
conv = HeteroGraphConv({
    'shared_relation1': shared_conv,
    'shared_relation2': shared_conv,
    'not_shared_relation': SAGEConv(...)
    })

But I can only do this if my source and destination node_types are the same for shared_relation1 and shared_relation2. Please correct me if I am wrong.

The source node types need to be the same unless the features of different node types fall into the same feature distribution. The destination node types may not need to be the same if a GNN layer does not require using the features of destination nodes.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.