gammagl.layers.conv.HypergraphConv

class HypergraphConv(in_channels, out_channels, ea_len, use_attention=False, heads=1, concat=True, negative_slope=0.2, dropout=0.0, bias=True, **kwargs)[source]
reset_parameters()[source]
forward(x, hyperedge_index, hyperedge_weight, hyperedge_attr)[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, alpha, y, edge_weight=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, optional) – weight of each edge.

Returns:

  • tensor – output message

  • Returns – the message matrix, and the shape is [num_edges, message_dim]

aggregate(msg, edge_index, num_nodes=None, aggr='sum')[source]

Function that aggregates message from edges to destination nodes.

Parameters:
  • msg (tensor) – message construct by message function.

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

  • num_nodes (int, optional) – number of nodes of the graph.

  • aggr (str, optional) – aggregation type, default = ‘sum’, optional=[‘sum’, ‘mean’, ‘max’].

Returns:

aggregation outcome.

Return type:

tensor