gammagl.layers.conv.HANConv¶
- class HANConv(in_channels, out_channels, metadata, heads=1, negative_slope=0.2, dropout_rate=0.5)[source]¶
The Heterogenous Graph Attention Operator from the “Heterogenous Graph Attention Network” paper.
Note
For an example of using HANConv, see examples/han_trainer.py.
- Parameters:
in_channels (int, dict[str, int]) – Size of each input sample of every node type, or
-1to derive the size from the first input(s) to the forward method.out_channels (int) – Size of each output sample.
metadata (tuple[list[str], list[tuple[str, str, str]]]) – The metadata of the heterogeneous graph, i.e. its node and edge types given by a list of strings and a list of string triplets, respectively. See
gammagl.data.HeteroGraph.metadata()for more information.heads (int, optional) – Number of multi-head-attentions. (default:
1)negative_slope (float, optional) – LeakyReLU angle of the negative slope. (default:
0.2)dropout (float, optional) – Dropout probability of the normalized attention coefficients which exposes each node to a stochastically sampled neighborhood during training. (default:
0)**kwargs (optional) – Additional arguments of
gammagl.layers.conv.MessagePassing.
- forward(x_dict, edge_index_dict, num_nodes_dict)[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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.