phlower.nn.EdgeToNodeSum

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

Bases: IGenericPhlowerCoreModule[IPhlowerLayerParameters, PhlowerTensor], Module

EdgeToNodeSum sums the edge feature onto the receiver node of each edge: v_i = sum_k e_k over the edges (i, j) with receiver i. Self-loop edges are ignored.

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

The input must be edge features whose n_edges axis follows the edge ordering of the support, such as the output of EdgeDifference or EdgeGather with the same support.

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

  • nodes (list[int] | None)

Examples

>>> edge_to_node_sum = EdgeToNodeSum(support_name="support")
>>> edge_to_node_sum(data, field_data=field_data)

Methods

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

forward function which overloads torch.nn.Module

from_setting(setting)

Create EdgeToNodeSum 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 EdgeToNodeSum from setting object

Parameters:

setting (EdgeToNodeSumSetting) – setting object

Returns:

EdgeToNodeSum object

Return type:

EdgeToNodeSum

classmethod get_nn_name()[source]

Return neural network name

Returns:

name

Return type:

str