phlower.nn.GraphLaplacian¶
- class phlower.nn.GraphLaplacian(support_name, factor=1.0, nodes=None)[source]¶
Bases:
IGenericPhlowerCoreModule[IPhlowerLayerParameters,PhlowerTensor],ModuleGraphLaplacian applies the graph Laplacian of the support A:
(L h)_i = factor * sum_j A_ij (h_j - h_i), that isL = factor * (A - D)with the degree matrixD_ii = sum_j A_ij.The output is zero on a constant field, so L works as a high-pass filter: it removes the smooth part of h and keeps the variations between neighboring nodes.
input: ([t,] n_nodes, …, f) output: ([t,] n_nodes, …, f)
tis optional.- Parameters:
support_name (str) – Name of the support tensor A, of shape (n_nodes, n_nodes).
factor (float) – Factor to multiply the Laplacian.
nodes (list[int] | None)
Examples
>>> graph_laplacian = GraphLaplacian(support_name="support") >>> graph_laplacian(data, field_data=field_data)
Methods
forward(data, *, field_data, **kwards)forward function which overloads torch.nn.Module
from_setting(setting)Create GraphLaplacian from setting object
Return neural network name
Attributes
T_destinationcall_super_initdump_patchestraining- 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