How to use new heterogeneous layers to create model that operates directly on heterogeneous graph?

Hi,

HGTConv in forward pass needs ntype and etype as arguments. Generally I would like to build new layer that will be using TypedLinear as in HGTConv and it will operate directly on heterogeneous graph instead of homogenous, but I have no idea how to get ntype and etype arguments in model’s forward to pass it to layers. I would like to have one layer that will be shared for all relations, and than node features will be projected regarding its ntype or etype in this relation. Is it possible to use TypedLinear for this case or should I use HeteroLinear instead? With the latter case I still have no idea how to get ntype and etype if I would like to use it with HeteroGraphConv.

I found that for my case it is more convenient to write similar loop over canonical etypes to HeteroGraphConv and than just use torch.nn.ModuleDict for linear projections regarding relation type. Is it possible to use TypedLinear on transformed heterogeneous graph to homogeneous to make linear projection regarding canonical etype instead of ntype/etype?

Check out nn.HeteroLinear.