phlower.nn.EdgeGather

class phlower.nn.EdgeGather(support_name, nodes=None)[source]

Bases: IGenericPhlowerCoreModule[IPhlowerLayerParameters, PhlowerTensor], Module

EdgeGather concatenates the nodal features of the two endpoints of each edge: e_k = [h_i, h_j] for the k-th edge (i, j). Self-loop edges are ignored.

input: ([t,] n_nodes, …, f) output: ([t,] n_edges, …, 2 * f) t is optional.

Combined with EdgeDifference and EdgeToNodeSum, this allows message-passing blocks such as MeshGraphNets to be assembled from feature-wise modules like MLP.

Parameters:
  • support_name (str) – Name of the support tensor defining the edges.

  • nodes (list[int] | None)

Examples

>>> edge_gather = EdgeGather(support_name="support")
>>> edge_gather(data, field_data=field_data)

Methods

forward(data, *, field_data, **kwards)

forward function which overloads torch.nn.Module

from_setting(setting)

Create EdgeGather from setting object

get_nn_name()

Return neural network name

Attributes

T_destination

call_super_init

dump_patches

training

forward(data, *, field_data, **kwards)[source]

forward function which overloads torch.nn.Module

Parameters:
  • data (IPhlowerTensorCollections) – IPhlowerTensorCollections data which receives from predecessors

  • field_data (ISimulationField) – ISimulationField | None Constant information through training or prediction

Returns:

Tensor object

Return type:

PhlowerTensor

classmethod from_setting(setting)[source]

Create EdgeGather from setting object

Parameters:

setting (EdgeGatherSetting) – setting object

Returns:

EdgeGather object

Return type:

EdgeGather

classmethod get_nn_name()[source]

Return neural network name

Returns:

name

Return type:

str