fix rendering part 1

This commit is contained in:
giovanni
2025-03-13 22:31:26 +01:00
committed by Nicola Demo
parent 5d908a291d
commit e0ad4dc8a0
15 changed files with 89 additions and 63 deletions

View File

@@ -6,8 +6,9 @@ from .equation_interface import EquationInterface
class Equation(EquationInterface):
"""
Implementation of the Equation class. Every ``equation`` passed to a
:class:`~pina.condition.Condition` object must be either a :class:`Equation`
or a :class:`~pina.equation.SystemEquation` instance.
:class:`~pina.condition.condition.Condition` object must be either an
instance of :class:`Equation` or
:class:`~pina.equation.system_equation.SystemEquation`.
"""
def __init__(self, equation):
@@ -32,10 +33,11 @@ class Equation(EquationInterface):
:param LabelTensor input_: Input points where the equation is evaluated.
:param LabelTensor output_: Output tensor, eventually produced by a
:class:`~torch.nn.Module` instance.
:class:`torch.nn.Module` instance.
:param dict params_: Dictionary of unknown parameters, associated with a
:class:`~pina.problem.InverseProblem` instance. If the equation is
not related to a :class:`~pina.problem.InverseProblem` instance, the
:class:`~pina.problem.inverse_problem.InverseProblem` instance.
If the equation is not related to a
:class:`~pina.problem.inverse_problem.InverseProblem` instance, the
parameters must be initialized to ``None``. Default is ``None``.
:return: The computed residual of the equation.
:rtype: LabelTensor

View File

@@ -28,7 +28,7 @@ class FixedValue(Equation):
:param LabelTensor input_: Input points where the equation is
evaluated.
:param LabelTensor output_: Output tensor, eventually produced by a
:class:`~torch.nn.Module` instance.
:class:`torch.nn.Module` instance.
:return: The computed residual of the equation.
:rtype: LabelTensor
"""
@@ -66,7 +66,7 @@ class FixedGradient(Equation):
:param LabelTensor input_: Input points where the equation is
evaluated.
:param LabelTensor output_: Output tensor, eventually produced by a
:class:`~torch.nn.Module` instance.
:class:`torch.nn.Module` instance.
:return: The computed residual of the equation.
:rtype: LabelTensor
"""
@@ -101,7 +101,7 @@ class FixedFlux(Equation):
:param LabelTensor input_: Input points where the equation is
evaluated.
:param LabelTensor output_: Output tensor, eventually produced by a
:class:`~torch.nn.Module` instance.
:class:`torch.nn.Module` instance.
:return: The computed residual of the equation.
:rtype: LabelTensor
"""
@@ -136,7 +136,7 @@ class Laplace(Equation):
:param LabelTensor input_: Input points where the equation is
evaluated.
:param LabelTensor output_: Output tensor, eventually produced by a
:class:`~torch.nn.Module` instance.
:class:`torch.nn.Module` instance.
:return: The computed residual of the equation.
:rtype: LabelTensor
"""

View File

@@ -6,6 +6,18 @@ from abc import ABCMeta, abstractmethod
class EquationInterface(metaclass=ABCMeta):
"""
Abstract base class for equations.
Equations in PINA simplify the training process. When defining a problem,
each equation passed to a :class:`~pina.condition.condition.Condition`
object must be either an :class:`~pina.equation.equation.Equation` or a
:class:`~pina.equation.system_equation.SystemEquation` instance.
An :class:`~pina.equation.equation.Equation` is a wrapper for a callable
function, while :class:`~pina.equation.system_equation.SystemEquation`
wraps a list of callable functions. To streamline code writing, PINA
provides a diverse set of pre-implemented equations, such as
:class:`~pina.equation.equation_factory.FixedValue`,
:class:`~pina.equation.equation_factory.FixedGradient`, and many others.
"""
@abstractmethod
@@ -15,9 +27,9 @@ class EquationInterface(metaclass=ABCMeta):
:param LabelTensor input_: Input points where the equation is evaluated.
:param LabelTensor output_: Output tensor, eventually produced by a
:class:`~torch.nn.Module` instance.
:class:`torch.nn.Module` instance.
:param dict params_: Dictionary of unknown parameters, associated with a
:class:`~pina.problem.InverseProblem` instance.
:class:`~pina.problem.inverse_problem.InverseProblem` instance.
:return: The computed residual of the equation.
:rtype: LabelTensor
"""

View File

@@ -9,8 +9,9 @@ from ..utils import check_consistency
class SystemEquation(EquationInterface):
"""
Implementation of the System of Equations. Every ``equation`` passed to a
:class:`~pina.condition.Condition` object must be either a :class:`Equation`
or a :class:`~pina.equation.SystemEquation` instance.
:class:`~pina.condition.condition.Condition` object must be either a
:class:`~pina.equation.equation.Equation` or a
:class:`~pina.equation.system_equation.SystemEquation` instance.
"""
def __init__(self, list_equation, reduction=None):
@@ -56,10 +57,11 @@ class SystemEquation(EquationInterface):
:param LabelTensor input_: Input points where each equation of the
system is evaluated.
:param LabelTensor output_: Output tensor, eventually produced by a
:class:`~torch.nn.Module` instance.
:class:`torch.nn.Module` instance.
:param dict params_: Dictionary of unknown parameters, associated with a
:class:`~pina.problem.InverseProblem` instance. If the equation is
not related to a :class:`~pina.problem.InverseProblem` instance, the
:class:`~pina.problem.inverse_problem.InverseProblem` instance.
If the equation is not related to a
:class:`~pina.problem.inverse_problem.InverseProblem` instance, the
parameters must be initialized to ``None``. Default is ``None``.
:return: The aggregated residuals of the system of equations.