BaseGCNStack

class openff.nagl.nn.gcn.BaseGCNStack(*args, _is_dgl: bool = False, **kwargs)[source]

Bases: ModuleList, Generic[GCNLayerType], ContainsLayersMixin, ABC

A wrapper around a stack of GCN graph convolutional layers.

Note:

This class is based on the dgllife.model.SAGEConv module.

Methods

append_gcn_layer

Add a new layer to the stack.

create_gcn_layer

Create a new GCN layer.

forward

Update node representations.

reset_parameters

Reinitialize model parameters.

with_layers

Create this model with layers with the specified parameters.

Attributes

available_aggregator_types

The aggregator options to use for the GCN layers.

default_activation_function

The aggregator options to use for the GCN layers.

default_aggregator_type

The aggregator options to use for the GCN layers.

default_dropout

The aggregator options to use for the GCN layers.

name

training

append_gcn_layer(n_output_features: int, n_input_features: int | None = None, aggregator_type: str | None = None, dropout: float | None = None, activation_function: ActivationFunction | None = None)[source]

Add a new layer to the stack.

abstract property available_aggregator_types

The aggregator options to use for the GCN layers.

classmethod create_gcn_layer(n_input_features: int, n_output_features: int, aggregator_type: str | None = None, dropout: float | None = None, activation_function: ActivationFunction | None = None, **kwargs) GCNLayerType[source]

Create a new GCN layer.

abstract property default_activation_function

The aggregator options to use for the GCN layers.

abstract property default_aggregator_type

The aggregator options to use for the GCN layers.

abstract property default_dropout

The aggregator options to use for the GCN layers.

forward(graph, inputs: Tensor) Tensor[source]

Update node representations.

Args:

graph: The batch of graphs to operate on. inputs: The inputs to the layers with shape=(n_nodes, in_feats).

Returns

The output hidden features with shape=(n_nodes, hidden_feats[-1]).

abstract property name
reset_parameters()[source]

Reinitialize model parameters.

classmethod with_layers(n_input_features: int, hidden_feature_sizes: List[int], layer_activation_functions: List[ActivationFunction] | None = None, layer_dropout: List[float] | None = None, layer_aggregator_types: List[str] | None = None)[source]

Create this model with layers with the specified parameters.