gammagl.layers.conv.CompConv

class CompConv(in_channels, out_channels, num_relations, op='sub', add_bias=True)[source]

Paper: Composition-based Multi-Relational Graph Convolutional Networks

Code: https://github.com/MichSchli/RelationPrediction

Parameters:
  • in_channels (int) – the input dimension of the features.

  • out_channels (int) – the output dimension of the features.

  • num_relations (int) – the number of relations in the graph.

  • op (str) – the operation used in message creation.

  • add_bias (bool) – whether to add bias.

forward(x, edge_index, edge_type=None, ref_emb=None)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

message(x, edge_index, edge_type, edge_weight=None, rel_emb=None, linear=None)[source]

Function that construct message from source nodes to destination nodes.

Parameters:
  • x (tensor) – input node feature.

  • edge_index (tensor) – edges from src to dst.

  • edge_weight (tensor) – weight of each edge.

Returns:

output message.

Return type:

tensor