Inverse problem implementation (#177)
* inverse problem implementation * add tutorial7 for inverse Poisson problem * fix doc in equation, equation_interface, system_equation --------- Co-authored-by: Dario Coscia <dariocoscia@dhcp-015.eduroam.sissa.it>
This commit is contained in:
committed by
Nicola Demo
parent
a9f14ac323
commit
0b7a307cf1
@@ -8,7 +8,7 @@ class Equation(EquationInterface):
|
||||
"""
|
||||
Equation class for specifing any equation in PINA.
|
||||
Each ``equation`` passed to a ``Condition`` object
|
||||
must be an ``Equation`` or ``SystemEquation``.
|
||||
must be an ``Equation`` or ``SystemEquation``.
|
||||
|
||||
:param equation: A ``torch`` callable equation to
|
||||
evaluate the residual.
|
||||
@@ -20,14 +20,26 @@ class Equation(EquationInterface):
|
||||
f'{equation}')
|
||||
self.__equation = equation
|
||||
|
||||
def residual(self, input_, output_):
|
||||
def residual(self, input_, output_, params_ = None):
|
||||
"""
|
||||
Residual computation of the equation.
|
||||
|
||||
:param LabelTensor input_: Input points to evaluate the equation.
|
||||
:param LabelTensor output_: Output vectors given my a model (e.g,
|
||||
:param LabelTensor output_: Output vectors given by a model (e.g,
|
||||
a ``FeedForward`` model).
|
||||
:param dict params_: Dictionary of parameters related to the inverse
|
||||
problem (if any).
|
||||
If the equation is not related to an ``InverseProblem``, the
|
||||
parameters are initialized to ``None`` and the residual is
|
||||
computed as ``equation(input_, output_)``.
|
||||
Otherwise, the parameters are automatically initialized in the
|
||||
ranges specified by the user.
|
||||
|
||||
:return: The residual evaluation of the specified equation.
|
||||
:rtype: LabelTensor
|
||||
"""
|
||||
return self.__equation(input_, output_)
|
||||
if params_ is None:
|
||||
result = self.__equation(input_, output_)
|
||||
else:
|
||||
result = self.__equation(input_, output_, params_)
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user