phlower.nn.Residual¶
- class phlower.nn.Residual(symbols_from_input, symbols_from_field, equation, nodes=None)[source]¶
Bases:
IGenericPhlowerCoreModule[IPhlowerLayerParameters,PhlowerTensor],ModuleResidual module computes the residual of a given equation based on the input data and field data.
- Parameters:
symbols_from_inputs (list[str]) – List of symbols corresponding to the input data.
symbols_from_field (list[str]) – List of symbols corresponding to the field data.
equation (str) – The equation to compute the residual.
nodes (list[int], optional) – List of feature dimension sizes (The last value of tensor shape).
symbols_from_input (list[str])
Examples
>>> residual = Residual( >>> symbols_from_inputs=["x", "y"], >>> symbols_from_field=["c"], >>> equation="Diff(u, x) + Diff(u, y) - c", >>> ) >>> residual(data, field_data)
Methods
forward(data, *[, field_data])forward function which overloads torch.nn.Module
from_setting(setting)get_nn_name()Attributes
T_destinationall_symbolscall_super_initdump_patchestraining- forward(data, *, field_data=None, **kwards)[source]¶
forward function which overloads torch.nn.Module
- Parameters:
data (IPhlowerTensorCollections) – IPhlowerTensorCollections data which receives from predecessors
field_data (ISimulationField | None) – ISimulationField | None Constant information through training or prediction
- Returns:
Tensor object
- Return type:
PhlowerTensor