Graph Neural Operator Block#

class GNOBlock(width, edges_features, n_layers=2, layers=None, inner_size=None, internal_func=None, external_func=None)[source]

Bases: MessagePassing

The inner block of the Graph Neural Operator, based on Message Passing.

Initialization of the GNOBlock class.

Parameters:
  • width (int) – The width of the kernel.

  • edge_features (int) – The number of edge features.

  • n_layers (int) – The number of kernel layers. Default is 2.

  • layers (list[int] | tuple[int]) – A list specifying the number of neurons for each layer of the neural network. If not None, it overrides the inner_size and n_layers``parameters. Default is ``None.

  • inner_size (int) – The size of the inner layer. Default is None.

  • internal_func (torch.nn.Module) – The activation function applied to the output of each layer. If None, it uses the torch.nn.Tanh activation. Default is None.

  • external_func (torch.nn.Module) – The activation function applied to the output of the block. If None, it uses the torch.nn.Tanh. activation. Default is None.

message_and_aggregate(edge_index, x, edge_attr)[source]

Combine messages and perform aggregation.

Parameters:
Returns:

The aggregated messages.

Return type:

torch.Tensor

edge_update(edge_attr)[source]

Update edge features.

Parameters:

edge_attr (torch.Tensor) – The edge features.

Returns:

The updated edge features.

Return type:

torch.Tensor

update(aggr_out, x)[source]

Update node features.

Parameters:
Returns:

The updated node features.

Return type:

torch.Tensor

forward(x, edge_index, edge_attr)[source]

Forward pass of the block.

Parameters:
Returns:

The updated node features.

Return type:

torch.Tensor