simplify kwargs logic for equations

This commit is contained in:
Dario Coscia
2025-09-04 14:55:37 +02:00
committed by Giovanni Canali
parent 684d691b78
commit 7469543499
2 changed files with 18 additions and 12 deletions

View File

@@ -190,13 +190,9 @@ class PINNInterface(SupervisedSolverInterface, metaclass=ABCMeta):
:return: The residual of the solution of the model.
:rtype: LabelTensor
"""
try:
residual = equation.residual(samples, self.forward(samples))
except TypeError:
# this occurs when the function has three inputs (inverse problem)
residual = equation.residual(
samples, self.forward(samples), self._params
)
residual = equation.residual(
samples, self.forward(samples), self._params
)
return residual
def _residual_loss(self, samples, equation):