System Equation#
- class SystemEquation(list_equation, reduction=None)[source]#
Bases:
EquationInterface
Implementation of the System of Equations. Every
equation
passed to aCondition
object must be either aEquation
or aSystemEquation
instance.Initialization of the
SystemEquation
class.- Parameters:
equation (Callable) – A
torch
callable function used to compute the residual of a mathematical equation.reduction (str) – The reduction method to aggregate the residuals of each equation. Available options are:
None
,mean
,sum
,callable
. IfNone
, no reduction is applied. Ifmean
, the output sum is divided by the number of elements in the output. Ifsum
, the output is summed.callable
is a user-defined callable function to perform reduction, no checks guaranteed. Default isNone
.
- Raises:
NotImplementedError – If the reduction is not implemented.
- residual(input_, output_, params_=None)[source]#
Compute the residual for each equation in the system of equations and aggregate it according to the
reduction
specified in the__init__
method.- Parameters:
input (LabelTensor) – Input points where each equation of the system is evaluated.
output (LabelTensor) – Output tensor, eventually produced by a
torch.nn.Module
instance.params (dict) – Dictionary of unknown parameters, associated with a
InverseProblem
instance. If the equation is not related to aInverseProblem
instance, the parameters must be initialized toNone
. Default isNone
.
- Returns:
The aggregated residuals of the system of equations.
- Return type: