diff --git a/README.md b/README.md
index 3369cc5d5..0ddbd3410 100644
--- a/README.md
+++ b/README.md
@@ -219,8 +219,8 @@ Want to dive deeper? Check out the official
import torch
from pina import Trainer
from pina.model import FeedForward
-from pina.solver import SupervisedSolver
from pina.problem.zoo import SupervisedProblem
+from pina.solver import SupervisedSingleModelSolver
input_tensor = torch.rand((10, 1))
target_tensor = input_tensor.pow(3)
@@ -232,7 +232,7 @@ problem = SupervisedProblem(input_tensor, target_tensor)
model = FeedForward(input_dimensions=1, output_dimensions=1, layers=[64, 64])
# Step 3. Define solver
-solver = SupervisedSolver(problem, model, use_lt=False)
+solver = SupervisedSingleModelSolver(problem, model, use_lt=False)
# Step 4. Train
trainer = Trainer(solver, max_epochs=1000, accelerator="gpu")
@@ -261,13 +261,14 @@ In PINA, this can be implemented as:
```python
-from pina import Trainer, Condition
-from pina.problem import SpatialProblem
from pina.operator import grad
-from pina.solver import PINN
from pina.model import FeedForward
+from pina.equation import Equation
+from pina import Trainer, Condition
from pina.domain import CartesianDomain
-from pina.equation import Equation, FixedValue
+from pina.problem import SpatialProblem
+from pina.equation.zoo import FixedValue
+from pina.solver import PhysicsInformedSingleModelSolver
def ode_equation(input_, output_):
u_x = grad(output_, input_, components=["u"], d=["x"])
@@ -294,7 +295,7 @@ problem.discretise_domain(n=100, mode="grid", domains=["D", "x0"])
model = FeedForward(input_dimensions=1, output_dimensions=1, layers=[64, 64])
# Step 3. Define solver
-solver = PINN(problem, model)
+solver = PhysicsInformedSingleModelSolver(problem, model)
# Step 4. Train
trainer = Trainer(solver, max_epochs=1000, accelerator="gpu")
diff --git a/docs/source/_LICENSE.rst b/docs/source/_LICENSE.rst
index 12090deb2..fa9bfd3cc 100644
--- a/docs/source/_LICENSE.rst
+++ b/docs/source/_LICENSE.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
License
==============
diff --git a/docs/source/_cite.rst b/docs/source/_cite.rst
index 786134b5b..eddf70046 100644
--- a/docs/source/_cite.rst
+++ b/docs/source/_cite.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Cite PINA
==============
diff --git a/docs/source/_contributing.rst b/docs/source/_contributing.rst
index dbc06912b..b981f6ba7 100644
--- a/docs/source/_contributing.rst
+++ b/docs/source/_contributing.rst
@@ -1,32 +1,26 @@
-Contributing to PINA
-=====================
+.. docmeta::
+ :last_reviewed: 2026-06-24
-First off, thanks for taking the time to contribute to **PINA**! 🎉 Your help makes the project better for everyone. This document outlines the process for contributing, reporting issues, suggesting features, and submitting pull requests.
-Table of Contents
-------------------------
+Contributing to PINA
+=====================
-1. `How to Contribute`_
-2. `Reporting Bugs`_
-3. `Suggesting Enhancements`_
-4. `Pull Request Process`_
-5. `Code Style & Guidelines`_
-6. `Community Standards`_
+First off, thanks for taking the time to contribute to **PINA**! Your help makes the project better for everyone. This document outlines the process for contributing, reporting issues, suggesting features, and submitting pull requests.
How to Contribute
-------------------------
+-----------------
You can contribute in several ways:
- Reporting bugs
-- Suggesting features/enhancements
+- Suggesting features or enhancements
- Submitting fixes or improvements via Pull Requests (PRs)
- Improving documentation
We encourage all contributions, big or small!
Reporting Bugs
-------------------------
+--------------
If you find a bug, please open an `issue `_ and include:
@@ -38,23 +32,23 @@ If you find a bug, please open an `issue `_ or the `discussions `_ to see if someone has already suggested it.
2. If not, open a new issue describing:
- - The enhancement you'd like
+ - The enhancement you would like
- Why it would be useful
- Any ideas on how to implement it (optional but helpful)
-3. If you are not sure about (something of) the enhancement, we suggest opening a discussion to collaborate on it with the PINA community.
+3. If you are not sure about the enhancement, open a discussion to collaborate with the PINA community.
Pull Request Process
-------------------------
+--------------------
Before submitting a PR:
-1. Ensure there’s an open issue related to your contribution (or create one).
+1. Ensure there is an open issue related to your contribution (or create one).
2. `Fork `_ the repository and create a new branch from ``master``:
.. code-block:: bash
@@ -71,23 +65,23 @@ Before submitting a PR:
pytest
-5. Properly format your code. If you want to save time, simply run:
+5. Format your code:
.. code-block:: bash
bash code_formatter.sh
-7. Submit a `pull request `_ with a clear explanation of your changes and reference the related issue if applicable.
+6. Submit a `pull request `_ with a clear explanation of your changes and reference the related issue if applicable.
-Pull Request Checklist
+Pull Request Checklist:
-1. Code follows the project’s style guidelines
+1. Code follows the project's style guidelines
2. Tests have been added or updated
3. Documentation has been updated if necessary
4. Pull request is linked to an open issue (if applicable)
Code Style & Guidelines
-------------------------
+-----------------------
- Follow PEP8 for Python code.
- Use descriptive commit messages (e.g. ``Fix parser crash on empty input``).
@@ -95,6 +89,12 @@ Code Style & Guidelines
- Keep functions small and focused; do one thing and do it well.
Community Standards
-------------------------
+-------------------
By participating in this project, you agree to abide by our Code of Conduct. We are committed to maintaining a welcoming and inclusive community.
+
+See Also
+--------
+
+* :doc:`Installation guide <_installation>`
+* :doc:`API Reference <_rst/_code>`
diff --git a/docs/source/_installation.rst b/docs/source/_installation.rst
index edfd0575b..a0bca26f5 100644
--- a/docs/source/_installation.rst
+++ b/docs/source/_installation.rst
@@ -1,52 +1,70 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Installation
============
-**PINA** requires requires `torch`, `lightning`, `torch_geometric` and `matplotlib`.
+**PINA** requires `torch`, `lightning`, `torch_geometric` and `matplotlib`.
Installing via PIP
__________________
-Mac and Linux users can install pre-built binary packages using pip.
-To install the package just type:
+Mac and Linux users can install pre-built binary packages using pip:
.. code-block:: bash
- $ pip install pina-mathlab
+ pip install pina-mathlab
To uninstall the package:
.. code-block:: bash
- $ pip uninstall pina-mathlab
+ pip uninstall pina-mathlab
Installing from source
______________________
-The official distribution is on GitHub, and you can clone the repository using
-.. code-block:: bash
-
- $ git clone https://github.com/mathLab/PINA
+The official distribution is on GitHub. Clone the repository:
-To install the package just type:
-
.. code-block:: bash
- $ pip install -e .
+ git clone https://github.com/mathLab/PINA
+
+Then install in editable mode:
+
+.. code-block:: bash
+ pip install -e .
Install with extra packages
____________________________
-To install extra dependencies required to run tests or tutorials directories, please use the following command:
+To install extra dependencies required to run tests or tutorials, use:
.. code-block:: bash
- $ pip install "pina-mathlab[extras]"
-
+ pip install "pina-mathlab[extras]"
Available extras include:
-* `dev` for development purpuses, use this if you want to Contribute.
-* `test` for running test locally.
-* `doc` for building documentation locally.
-* `tutorial` for running tutorials
+* ``dev`` — development tools (use this if you want to contribute).
+* ``test`` — for running tests locally.
+* ``doc`` — for building the documentation locally.
+* ``tutorial`` — for running tutorials.
+
+Requirements
+____________
+
+PINA is built on:
+
+* `PyTorch `_ — deep learning framework.
+* `PyTorch Lightning `_ — training loop orchestration.
+* `PyTorch Geometric `_ — graph neural network support.
+* `Matplotlib `_ — plotting and visualisation.
+
+See Also
+--------
+
+* :doc:`Quickstart guide <_quickstart>`
+* :doc:`API Reference <_rst/_code>`
diff --git a/docs/source/_quickstart.rst b/docs/source/_quickstart.rst
new file mode 100644
index 000000000..47cfd05a0
--- /dev/null
+++ b/docs/source/_quickstart.rst
@@ -0,0 +1,100 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
+Quickstart
+==========
+
+This guide gets you up and running with PINA in 5 minutes. By the end, you will have trained a Physics-Informed Neural Network (PINN) to solve the Poisson equation on a unit square.
+
+Install
+-------
+
+.. code-block:: bash
+
+ pip install pina-mathlab
+
+Define a problem
+----------------
+
+Every PINA workflow starts by defining a :class:`~pina.problem.spatial_problem.SpatialProblem`.
+A problem specifies the output variables, the computational domain, and the conditions
+(PDE residual, boundary conditions, initial conditions, data) that the solver must satisfy.
+
+.. code-block:: python
+
+ from pina import Condition
+ from pina.problem import SpatialProblem
+ from pina.domain import CartesianDomain
+ from pina.equation import Equation, FixedValue
+
+ class PoissonProblem(SpatialProblem):
+ output_variables = ["u"]
+
+ domains = {
+ "domain": CartesianDomain({"x": [0, 1], "y": [0, 1]}),
+ "boundary": CartesianDomain({"x": [0, 1], "y": [0, 1]}),
+ }
+
+ conditions = {
+ "domain": Condition(
+ domain="domain",
+ equation=Equation("d2(u,x) + d2(u,y) + sin(pi*x)*sin(pi*y) = 0"),
+ ),
+ "boundary": Condition(
+ domain="boundary",
+ equation=FixedValue(0.0),
+ ),
+ }
+
+ problem = PoissonProblem()
+
+Create a model
+--------------
+
+Choose a neural network architecture. For standard PINNs, a :class:`~pina.model.feed_forward.FeedForward` (MLP) is a solid starting point.
+
+.. code-block:: python
+
+ from pina.model import FeedForward
+
+ model = FeedForward(
+ input_dimensions=2,
+ output_dimensions=1,
+ inner_size=20,
+ n_layers=3,
+ )
+
+Train with a solver
+-------------------
+
+The :class:`~pina.solver.physics_informed_solver.pinn.PINN` solver wraps the problem and model, and the :class:`~pina._src.core.trainer.Trainer` orchestrates the training loop.
+
+.. code-block:: python
+
+ from pina.solver import PINN
+ from pina import Trainer
+
+ pinn = PINN(problem=problem, model=model)
+ trainer = Trainer(solver=pinn, max_epochs=1000)
+ trainer.train()
+
+Inspect results
+---------------
+
+After training, the model stores its solution in the solver. Evaluate at any point:
+
+.. code-block:: python
+
+ import torch
+
+ x = torch.tensor([[0.5, 0.5]], requires_grad=True)
+ u_pred = pinn(x)
+ print(u_pred)
+
+What's next?
+------------
+
+* Walk through the `Introductory Tutorial `_ for a deeper introduction.
+* Explore the :doc:`API reference ` for all available components.
+* Read the :doc:`tutorials ` for domain-specific guides (Neural Operators, Supervised Learning, etc.).
diff --git a/docs/source/_rst/_code.rst b/docs/source/_rst/_code.rst
index 6b2111946..fbff12536 100644
--- a/docs/source/_rst/_code.rst
+++ b/docs/source/_rst/_code.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Code Documentation
==================
Welcome to PINA documentation! Here you can find the modules of the package divided in different sections.
@@ -8,7 +12,6 @@ The high-level structure of the package is depicted in our API.
:align: center
:width: 400
-
The pipeline to solve differential equations with PINA follows just five steps:
1. Define the `Problems`_ the user aim to solve
@@ -17,7 +20,6 @@ The pipeline to solve differential equations with PINA follows just five steps:
4. Choose a solver across PINA available `Solvers`_, or build one using the :doc:`SolverInterface `
5. Train the model with the PINA :doc:`Trainer `, enhance the train with `Callbacks`_
-
Trainer, Data Loader and Data Module
----------------------------------------
.. toctree::
@@ -39,7 +41,6 @@ Data Types
Graph
LabelBatch
-
Graphs Structures
------------------
.. toctree::
@@ -49,7 +50,6 @@ Graphs Structures
RadiusGraph
KNNGraph
-
Conditions
-------------
.. toctree::
@@ -173,7 +173,6 @@ Message Passing
Radial Field Network Block
EquivariantGraphNeuralOperatorBlock
-
Reduction and Embeddings
--------------------------
@@ -218,7 +217,6 @@ Adaptive Functions
Adaptive Softmin
Adaptive Tanh
-
Equations and Differential Operators
---------------------------------------
@@ -231,7 +229,6 @@ Equations and Differential Operators
System Equation
Differential Operators
-
Equation Zoo
---------------------------------------
@@ -250,7 +247,6 @@ Equation Zoo
Helmholtz Equation
Poisson Equation
-
Problems
--------------
@@ -280,7 +276,6 @@ Problem Zoo
Poisson 2D Square Problem
Supervised Problem
-
Geometrical Domains
--------------------
@@ -321,7 +316,6 @@ Callbacks
Metric Tracker
PINA Progress Bar
-
Losses
---------
@@ -334,7 +328,6 @@ Losses
PowerLoss
SinkhornLoss
-
Weighting Schemas
--------------------
@@ -347,4 +340,4 @@ Weighting Schemas
Neural-Tangent-Kernel Weighting
No Weighting
Scalar Weighting
- Self-Adaptive Weighting
+ Self-Adaptive Weighting
\ No newline at end of file
diff --git a/docs/source/_rst/adaptive_function/adaptive_celu.rst b/docs/source/_rst/adaptive_function/adaptive_celu.rst
index b04bcf42b..f991077b4 100644
--- a/docs/source/_rst/adaptive_function/adaptive_celu.rst
+++ b/docs/source/_rst/adaptive_function/adaptive_celu.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Adaptive CELU
==================
.. currentmodule:: pina.adaptive_function.adaptive_celu
diff --git a/docs/source/_rst/adaptive_function/adaptive_elu.rst b/docs/source/_rst/adaptive_function/adaptive_elu.rst
index e758b20b3..b8ee58554 100644
--- a/docs/source/_rst/adaptive_function/adaptive_elu.rst
+++ b/docs/source/_rst/adaptive_function/adaptive_elu.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Adaptive ELU
=============================
.. currentmodule:: pina.adaptive_function.adaptive_elu
diff --git a/docs/source/_rst/adaptive_function/adaptive_exp.rst b/docs/source/_rst/adaptive_function/adaptive_exp.rst
index 3feeb6192..57d327a0a 100644
--- a/docs/source/_rst/adaptive_function/adaptive_exp.rst
+++ b/docs/source/_rst/adaptive_function/adaptive_exp.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Adaptive Exp
=============================
.. currentmodule:: pina.adaptive_function.adaptive_exp
diff --git a/docs/source/_rst/adaptive_function/adaptive_function_interface.rst b/docs/source/_rst/adaptive_function/adaptive_function_interface.rst
index e7859c0d2..7eb839fcc 100644
--- a/docs/source/_rst/adaptive_function/adaptive_function_interface.rst
+++ b/docs/source/_rst/adaptive_function/adaptive_function_interface.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Adaptive Function Interface
=============================
.. currentmodule:: pina.adaptive_function.adaptive_function_interface
diff --git a/docs/source/_rst/adaptive_function/adaptive_gelu.rst b/docs/source/_rst/adaptive_function/adaptive_gelu.rst
index a07960373..a1a934018 100644
--- a/docs/source/_rst/adaptive_function/adaptive_gelu.rst
+++ b/docs/source/_rst/adaptive_function/adaptive_gelu.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Adaptive GELU
=============================
.. currentmodule:: pina.adaptive_function.adaptive_gelu
diff --git a/docs/source/_rst/adaptive_function/adaptive_mish.rst b/docs/source/_rst/adaptive_function/adaptive_mish.rst
index f56c911fb..ae7c63fb9 100644
--- a/docs/source/_rst/adaptive_function/adaptive_mish.rst
+++ b/docs/source/_rst/adaptive_function/adaptive_mish.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Adaptive Mish
=============================
.. currentmodule:: pina.adaptive_function.adaptive_mish
diff --git a/docs/source/_rst/adaptive_function/adaptive_relu.rst b/docs/source/_rst/adaptive_function/adaptive_relu.rst
index a2032f344..a0d251035 100644
--- a/docs/source/_rst/adaptive_function/adaptive_relu.rst
+++ b/docs/source/_rst/adaptive_function/adaptive_relu.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Adaptive ReLU
=============================
.. currentmodule:: pina.adaptive_function.adaptive_relu
diff --git a/docs/source/_rst/adaptive_function/adaptive_sigmoid.rst b/docs/source/_rst/adaptive_function/adaptive_sigmoid.rst
index 8aef91c0d..1d70e80c8 100644
--- a/docs/source/_rst/adaptive_function/adaptive_sigmoid.rst
+++ b/docs/source/_rst/adaptive_function/adaptive_sigmoid.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Adaptive Sigmoid
=============================
.. currentmodule:: pina.adaptive_function.adaptive_sigmoid
diff --git a/docs/source/_rst/adaptive_function/adaptive_silu.rst b/docs/source/_rst/adaptive_function/adaptive_silu.rst
index 2d22dcf20..80cb2cf3b 100644
--- a/docs/source/_rst/adaptive_function/adaptive_silu.rst
+++ b/docs/source/_rst/adaptive_function/adaptive_silu.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Adaptive SiLU
=============================
.. currentmodule:: pina.adaptive_function.adaptive_silu
diff --git a/docs/source/_rst/adaptive_function/adaptive_siren.rst b/docs/source/_rst/adaptive_function/adaptive_siren.rst
index 167cd79ff..f05577478 100644
--- a/docs/source/_rst/adaptive_function/adaptive_siren.rst
+++ b/docs/source/_rst/adaptive_function/adaptive_siren.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Adaptive SIREN
=============================
.. currentmodule:: pina.adaptive_function.adaptive_siren
diff --git a/docs/source/_rst/adaptive_function/adaptive_softmax.rst b/docs/source/_rst/adaptive_function/adaptive_softmax.rst
index 8797acae9..41b014f41 100644
--- a/docs/source/_rst/adaptive_function/adaptive_softmax.rst
+++ b/docs/source/_rst/adaptive_function/adaptive_softmax.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Adaptive Softmax
=============================
.. currentmodule:: pina.adaptive_function.adaptive_softmax
diff --git a/docs/source/_rst/adaptive_function/adaptive_softmin.rst b/docs/source/_rst/adaptive_function/adaptive_softmin.rst
index 72ed8ae1f..935f5a598 100644
--- a/docs/source/_rst/adaptive_function/adaptive_softmin.rst
+++ b/docs/source/_rst/adaptive_function/adaptive_softmin.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Adaptive Softmin
=============================
.. currentmodule:: pina.adaptive_function.adaptive_softmin
diff --git a/docs/source/_rst/adaptive_function/adaptive_tanh.rst b/docs/source/_rst/adaptive_function/adaptive_tanh.rst
index dbd9e4313..dbd9b172d 100644
--- a/docs/source/_rst/adaptive_function/adaptive_tanh.rst
+++ b/docs/source/_rst/adaptive_function/adaptive_tanh.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Adaptive Tanh
=============================
.. currentmodule:: pina.adaptive_function.adaptive_tanh
diff --git a/docs/source/_rst/adaptive_function/base_adaptive_function.rst b/docs/source/_rst/adaptive_function/base_adaptive_function.rst
index 6b1e6cee7..607257ba5 100644
--- a/docs/source/_rst/adaptive_function/base_adaptive_function.rst
+++ b/docs/source/_rst/adaptive_function/base_adaptive_function.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Base Adaptive Function
=============================
.. currentmodule:: pina.adaptive_function.base_adaptive_function
diff --git a/docs/source/_rst/callback/optim/switch_optimizer.rst b/docs/source/_rst/callback/optim/switch_optimizer.rst
index 13b7db7ad..99c7f3127 100644
--- a/docs/source/_rst/callback/optim/switch_optimizer.rst
+++ b/docs/source/_rst/callback/optim/switch_optimizer.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Switch Optimizer
=====================
diff --git a/docs/source/_rst/callback/optim/switch_scheduler.rst b/docs/source/_rst/callback/optim/switch_scheduler.rst
index 42d5e6be0..874964d84 100644
--- a/docs/source/_rst/callback/optim/switch_scheduler.rst
+++ b/docs/source/_rst/callback/optim/switch_scheduler.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Switch Scheduler
=====================
diff --git a/docs/source/_rst/callback/processing/data_normalizer.rst b/docs/source/_rst/callback/processing/data_normalizer.rst
index 358d2f472..1f7eab3be 100644
--- a/docs/source/_rst/callback/processing/data_normalizer.rst
+++ b/docs/source/_rst/callback/processing/data_normalizer.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Data Normalizer
=======================
.. currentmodule:: pina.callback.processing.data_normalizer
diff --git a/docs/source/_rst/callback/processing/metric_tracker.rst b/docs/source/_rst/callback/processing/metric_tracker.rst
index 22d7cc229..a82184ba5 100644
--- a/docs/source/_rst/callback/processing/metric_tracker.rst
+++ b/docs/source/_rst/callback/processing/metric_tracker.rst
@@ -1,10 +1,12 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Metric Tracker
==================
.. currentmodule:: pina.callback.processing.metric_tracker
-
.. automodule:: pina._src.callback.processing.metric_tracker
-
-.. autoclass:: pina._src.callback.processing.metric_tracker.MetricTracker
+ :show-inheritance:
+.. autoclass:: MetricTracker
:members:
- :show-inheritance:
- :noindex:
+ :show-inheritance:
\ No newline at end of file
diff --git a/docs/source/_rst/callback/processing/pina_progress_bar.rst b/docs/source/_rst/callback/processing/pina_progress_bar.rst
index 9c64678eb..ab26ea57f 100644
--- a/docs/source/_rst/callback/processing/pina_progress_bar.rst
+++ b/docs/source/_rst/callback/processing/pina_progress_bar.rst
@@ -1,9 +1,12 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
PINA Progress Bar
==================
.. currentmodule:: pina.callback.processing.pina_progress_bar
-
.. automodule:: pina._src.callback.processing.pina_progress_bar
-
-.. autoclass:: pina._src.callback.processing.pina_progress_bar.PINAProgressBar
+ :show-inheritance:
+.. autoclass:: PINAProgressBar
:members:
- :show-inheritance:
+ :show-inheritance:
\ No newline at end of file
diff --git a/docs/source/_rst/callback/refinement/base_refinement.rst b/docs/source/_rst/callback/refinement/base_refinement.rst
index 5f8eaf218..310a2c261 100644
--- a/docs/source/_rst/callback/refinement/base_refinement.rst
+++ b/docs/source/_rst/callback/refinement/base_refinement.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Base Refinement
=======================
diff --git a/docs/source/_rst/callback/refinement/r3_refinement.rst b/docs/source/_rst/callback/refinement/r3_refinement.rst
index 0d787c840..f32742d73 100644
--- a/docs/source/_rst/callback/refinement/r3_refinement.rst
+++ b/docs/source/_rst/callback/refinement/r3_refinement.rst
@@ -1,7 +1,11 @@
-R3 Refinement
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
+Refinments callbacks
=======================
-.. currentmodule:: pina.callback.refinement.r3_refinement
+.. currentmodule:: pina.callback
.. autoclass:: pina._src.callback.refinement.r3_refinement.R3Refinement
:members:
:show-inheritance:
\ No newline at end of file
diff --git a/docs/source/_rst/callback/refinement/refinement_interface.rst b/docs/source/_rst/callback/refinement/refinement_interface.rst
index 1af845800..65aad0691 100644
--- a/docs/source/_rst/callback/refinement/refinement_interface.rst
+++ b/docs/source/_rst/callback/refinement/refinement_interface.rst
@@ -1,7 +1,11 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Refinement Interface
=======================
-.. currentmodule:: pina.callback.refinement.refinement_interface
+.. currentmodule:: pina.callback
.. autoclass:: pina._src.callback.refinement.refinement_interface.RefinementInterface
:members:
:show-inheritance:
\ No newline at end of file
diff --git a/docs/source/_rst/condition/base_condition.rst b/docs/source/_rst/condition/base_condition.rst
index 2ba4113bd..4391b5d15 100644
--- a/docs/source/_rst/condition/base_condition.rst
+++ b/docs/source/_rst/condition/base_condition.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Base Condition
================
.. currentmodule:: pina.condition.base_condition
diff --git a/docs/source/_rst/condition/condition.rst b/docs/source/_rst/condition/condition.rst
index 0f8070506..8ad6e99d8 100644
--- a/docs/source/_rst/condition/condition.rst
+++ b/docs/source/_rst/condition/condition.rst
@@ -1,9 +1,11 @@
-Condition
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
+Conditions
=============
.. currentmodule:: pina.condition.condition
-.. automodule:: pina._src.condition.condition
-
.. autoclass:: pina._src.condition.condition.Condition
:members:
- :show-inheritance:
+ :show-inheritance:
\ No newline at end of file
diff --git a/docs/source/_rst/condition/condition_interface.rst b/docs/source/_rst/condition/condition_interface.rst
index a81de1afa..43906fd85 100644
--- a/docs/source/_rst/condition/condition_interface.rst
+++ b/docs/source/_rst/condition/condition_interface.rst
@@ -1,9 +1,11 @@
-Condition Interface
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
+ConditionInterface
======================
.. currentmodule:: pina.condition.condition_interface
-.. automodule:: pina._src.condition.condition_interface
-
.. autoclass:: pina._src.condition.condition_interface.ConditionInterface
:members:
:show-inheritance:
\ No newline at end of file
diff --git a/docs/source/_rst/condition/data_condition.rst b/docs/source/_rst/condition/data_condition.rst
index d614fbb7b..05d9816e2 100644
--- a/docs/source/_rst/condition/data_condition.rst
+++ b/docs/source/_rst/condition/data_condition.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Data Condition
==================
.. currentmodule:: pina.condition.data_condition
diff --git a/docs/source/_rst/condition/domain_equation_condition.rst b/docs/source/_rst/condition/domain_equation_condition.rst
index 2c372f13f..8ef2eea05 100644
--- a/docs/source/_rst/condition/domain_equation_condition.rst
+++ b/docs/source/_rst/condition/domain_equation_condition.rst
@@ -1,9 +1,11 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Domain Equation Condition
===========================
.. currentmodule:: pina.condition.domain_equation_condition
-.. automodule:: pina._src.condition.domain_equation_condition
-
.. autoclass:: pina._src.condition.domain_equation_condition.DomainEquationCondition
:members:
:show-inheritance:
\ No newline at end of file
diff --git a/docs/source/_rst/condition/graph_time_series_condition.rst b/docs/source/_rst/condition/graph_time_series_condition.rst
index 6314980fb..a6c79312c 100644
--- a/docs/source/_rst/condition/graph_time_series_condition.rst
+++ b/docs/source/_rst/condition/graph_time_series_condition.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Graph Time Series Condition
=============================
diff --git a/docs/source/_rst/condition/input_equation_condition.rst b/docs/source/_rst/condition/input_equation_condition.rst
index da0a48476..0488b120b 100644
--- a/docs/source/_rst/condition/input_equation_condition.rst
+++ b/docs/source/_rst/condition/input_equation_condition.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Input Equation Condition
===========================
.. currentmodule:: pina.condition.input_equation_condition
diff --git a/docs/source/_rst/condition/input_target_condition.rst b/docs/source/_rst/condition/input_target_condition.rst
index da8333714..db1098dfe 100644
--- a/docs/source/_rst/condition/input_target_condition.rst
+++ b/docs/source/_rst/condition/input_target_condition.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Input Target Condition
===========================
.. currentmodule:: pina.condition.input_target_condition
@@ -6,4 +10,4 @@ Input Target Condition
.. autoclass:: pina._src.condition.input_target_condition.InputTargetCondition
:members:
- :show-inheritance:
+ :show-inheritance:
\ No newline at end of file
diff --git a/docs/source/_rst/condition/time_series_condition.rst b/docs/source/_rst/condition/time_series_condition.rst
index 49a5f8795..8a7914915 100644
--- a/docs/source/_rst/condition/time_series_condition.rst
+++ b/docs/source/_rst/condition/time_series_condition.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Time Series Condition
=======================
diff --git a/docs/source/_rst/data/aggregator.rst b/docs/source/_rst/data/aggregator.rst
index 738a57524..4a14218f4 100644
--- a/docs/source/_rst/data/aggregator.rst
+++ b/docs/source/_rst/data/aggregator.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Aggregator
================
.. currentmodule:: pina.data.aggregator
diff --git a/docs/source/_rst/data/condition_subset.rst b/docs/source/_rst/data/condition_subset.rst
index 84c032dc8..fcbde63a4 100644
--- a/docs/source/_rst/data/condition_subset.rst
+++ b/docs/source/_rst/data/condition_subset.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Condition Subset
================
.. currentmodule:: pina.data.condition_subset
diff --git a/docs/source/_rst/data/creator.rst b/docs/source/_rst/data/creator.rst
index 5d836292d..f834a1563 100644
--- a/docs/source/_rst/data/creator.rst
+++ b/docs/source/_rst/data/creator.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Creator
=======
.. currentmodule:: pina.data.creator
diff --git a/docs/source/_rst/data/data_module.rst b/docs/source/_rst/data/data_module.rst
index e31dae2b9..617ef1de6 100644
--- a/docs/source/_rst/data/data_module.rst
+++ b/docs/source/_rst/data/data_module.rst
@@ -1,7 +1,11 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
DataModule
======================
.. currentmodule:: pina.data.data_module
.. autoclass:: pina._src.data.data_module.DataModule
:members:
- :show-inheritance:
+ :show-inheritance:
\ No newline at end of file
diff --git a/docs/source/_rst/data/manager/batch_manager.rst b/docs/source/_rst/data/manager/batch_manager.rst
index 5d7c36650..05e0ce686 100644
--- a/docs/source/_rst/data/manager/batch_manager.rst
+++ b/docs/source/_rst/data/manager/batch_manager.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Batch Manager
======================
.. currentmodule:: pina.data.manager.batch_manager
diff --git a/docs/source/_rst/data/manager/data_manager.rst b/docs/source/_rst/data/manager/data_manager.rst
index 9b32b8242..f721572e0 100644
--- a/docs/source/_rst/data/manager/data_manager.rst
+++ b/docs/source/_rst/data/manager/data_manager.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Data Manager
======================
.. currentmodule:: pina.data.manager.data_manager
diff --git a/docs/source/_rst/data/manager/data_manager_interface.rst b/docs/source/_rst/data/manager/data_manager_interface.rst
index e4a502abf..ec03a3167 100644
--- a/docs/source/_rst/data/manager/data_manager_interface.rst
+++ b/docs/source/_rst/data/manager/data_manager_interface.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Data Manager Interface
=========================
.. currentmodule:: pina.data.manager.data_manager_interface
diff --git a/docs/source/_rst/data/manager/graph_data_manager.rst b/docs/source/_rst/data/manager/graph_data_manager.rst
index bbbf23a52..c058d0650 100644
--- a/docs/source/_rst/data/manager/graph_data_manager.rst
+++ b/docs/source/_rst/data/manager/graph_data_manager.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Graph Data Manager
======================
.. currentmodule:: pina.data.manager.graph_data_manager
diff --git a/docs/source/_rst/data/manager/tensor_data_manager.rst b/docs/source/_rst/data/manager/tensor_data_manager.rst
index f8bb06028..8f35afc45 100644
--- a/docs/source/_rst/data/manager/tensor_data_manager.rst
+++ b/docs/source/_rst/data/manager/tensor_data_manager.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Tensor Data Manager
======================
.. currentmodule:: pina.data.manager.tensor_data_manager
diff --git a/docs/source/_rst/data/single_batch_data_loader.rst b/docs/source/_rst/data/single_batch_data_loader.rst
index 7c1debb92..21942e4d8 100644
--- a/docs/source/_rst/data/single_batch_data_loader.rst
+++ b/docs/source/_rst/data/single_batch_data_loader.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Single-Batch Data Loader
===========================
.. currentmodule:: pina.data.single_batch_data_loader
diff --git a/docs/source/_rst/domain/base_domain.rst b/docs/source/_rst/domain/base_domain.rst
index 3850ba4fa..ab05a5173 100644
--- a/docs/source/_rst/domain/base_domain.rst
+++ b/docs/source/_rst/domain/base_domain.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
BaseDomain
===========
.. currentmodule:: pina.domain.base_domain
diff --git a/docs/source/_rst/domain/base_operation.rst b/docs/source/_rst/domain/base_operation.rst
index 122048d81..281ace2ec 100644
--- a/docs/source/_rst/domain/base_operation.rst
+++ b/docs/source/_rst/domain/base_operation.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
BaseOperation
==============
.. currentmodule:: pina.domain.base_operation
diff --git a/docs/source/_rst/domain/cartesian_domain.rst b/docs/source/_rst/domain/cartesian_domain.rst
index bc2afec03..575be7fe8 100644
--- a/docs/source/_rst/domain/cartesian_domain.rst
+++ b/docs/source/_rst/domain/cartesian_domain.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
CartesianDomain
======================
.. currentmodule:: pina.domain.cartesian_domain
diff --git a/docs/source/_rst/domain/difference.rst b/docs/source/_rst/domain/difference.rst
index 91ffd4ec9..25868215d 100644
--- a/docs/source/_rst/domain/difference.rst
+++ b/docs/source/_rst/domain/difference.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Difference
======================
.. currentmodule:: pina.domain.difference
diff --git a/docs/source/_rst/domain/domain_interface.rst b/docs/source/_rst/domain/domain_interface.rst
index 96594a23b..0428e321e 100644
--- a/docs/source/_rst/domain/domain_interface.rst
+++ b/docs/source/_rst/domain/domain_interface.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
DomainInterface
================
.. currentmodule:: pina.domain.domain_interface
diff --git a/docs/source/_rst/domain/ellipsoid_domain.rst b/docs/source/_rst/domain/ellipsoid_domain.rst
index 2cbc5f7ec..5f05e130a 100644
--- a/docs/source/_rst/domain/ellipsoid_domain.rst
+++ b/docs/source/_rst/domain/ellipsoid_domain.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
EllipsoidDomain
======================
.. currentmodule:: pina.domain.ellipsoid_domain
diff --git a/docs/source/_rst/domain/exclusion.rst b/docs/source/_rst/domain/exclusion.rst
index 040b48416..2a5968c1f 100644
--- a/docs/source/_rst/domain/exclusion.rst
+++ b/docs/source/_rst/domain/exclusion.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Exclusion
======================
.. currentmodule:: pina.domain.exclusion
diff --git a/docs/source/_rst/domain/intersection.rst b/docs/source/_rst/domain/intersection.rst
index 666fe0f00..c6775fb1a 100644
--- a/docs/source/_rst/domain/intersection.rst
+++ b/docs/source/_rst/domain/intersection.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Intersection
======================
.. currentmodule:: pina.domain.intersection
diff --git a/docs/source/_rst/domain/operation_interface.rst b/docs/source/_rst/domain/operation_interface.rst
index 42e92fbe8..0d7934bf0 100644
--- a/docs/source/_rst/domain/operation_interface.rst
+++ b/docs/source/_rst/domain/operation_interface.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
OperationInterface
======================
.. currentmodule:: pina.domain.operation_interface
diff --git a/docs/source/_rst/domain/simplex_domain.rst b/docs/source/_rst/domain/simplex_domain.rst
index 0aba5f912..c293f6a95 100644
--- a/docs/source/_rst/domain/simplex_domain.rst
+++ b/docs/source/_rst/domain/simplex_domain.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
SimplexDomain
======================
.. currentmodule:: pina.domain.simplex_domain
diff --git a/docs/source/_rst/domain/union.rst b/docs/source/_rst/domain/union.rst
index fc5ff92a9..f0992380f 100644
--- a/docs/source/_rst/domain/union.rst
+++ b/docs/source/_rst/domain/union.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Union
======================
.. currentmodule:: pina.domain.union
diff --git a/docs/source/_rst/equation/base_equation.rst b/docs/source/_rst/equation/base_equation.rst
index 5bb98901f..1dbd3b73a 100644
--- a/docs/source/_rst/equation/base_equation.rst
+++ b/docs/source/_rst/equation/base_equation.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Base Equation
====================
diff --git a/docs/source/_rst/equation/equation.rst b/docs/source/_rst/equation/equation.rst
index edb350090..2de24c8e3 100644
--- a/docs/source/_rst/equation/equation.rst
+++ b/docs/source/_rst/equation/equation.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Equation
==========
diff --git a/docs/source/_rst/equation/equation_interface.rst b/docs/source/_rst/equation/equation_interface.rst
index f16502831..9d729e88b 100644
--- a/docs/source/_rst/equation/equation_interface.rst
+++ b/docs/source/_rst/equation/equation_interface.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Equation Interface
====================
diff --git a/docs/source/_rst/equation/system_equation.rst b/docs/source/_rst/equation/system_equation.rst
index 88d1554f8..bfa54c47f 100644
--- a/docs/source/_rst/equation/system_equation.rst
+++ b/docs/source/_rst/equation/system_equation.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
System Equation
=================
diff --git a/docs/source/_rst/equation/zoo/acoustic_wave_equation.rst b/docs/source/_rst/equation/zoo/acoustic_wave_equation.rst
index 5bc19d920..88e66f978 100644
--- a/docs/source/_rst/equation/zoo/acoustic_wave_equation.rst
+++ b/docs/source/_rst/equation/zoo/acoustic_wave_equation.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
AcousticWaveEquation
=====================
.. currentmodule:: pina.equation.zoo.acoustic_wave_equation
diff --git a/docs/source/_rst/equation/zoo/advection_equation.rst b/docs/source/_rst/equation/zoo/advection_equation.rst
index 4386b3a3d..4c8f66810 100644
--- a/docs/source/_rst/equation/zoo/advection_equation.rst
+++ b/docs/source/_rst/equation/zoo/advection_equation.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Advection Equation
=====================
.. currentmodule:: pina.equation.zoo.advection_equation
diff --git a/docs/source/_rst/equation/zoo/allen_cahn_equation.rst b/docs/source/_rst/equation/zoo/allen_cahn_equation.rst
index fff220811..41d865ad5 100644
--- a/docs/source/_rst/equation/zoo/allen_cahn_equation.rst
+++ b/docs/source/_rst/equation/zoo/allen_cahn_equation.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Allen Cahn Equation
=====================
.. currentmodule:: pina.equation.zoo.allen_cahn_equation
diff --git a/docs/source/_rst/equation/zoo/burgers_equation.rst b/docs/source/_rst/equation/zoo/burgers_equation.rst
index 8f478621f..14a7a7909 100644
--- a/docs/source/_rst/equation/zoo/burgers_equation.rst
+++ b/docs/source/_rst/equation/zoo/burgers_equation.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Burgers' Equation
====================
.. currentmodule:: pina.equation.zoo.burgers_equation
diff --git a/docs/source/_rst/equation/zoo/diffusion_reaction_equation.rst b/docs/source/_rst/equation/zoo/diffusion_reaction_equation.rst
index d45143074..7851e73f8 100644
--- a/docs/source/_rst/equation/zoo/diffusion_reaction_equation.rst
+++ b/docs/source/_rst/equation/zoo/diffusion_reaction_equation.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Diffusion Reaction Equation
==============================
.. currentmodule:: pina.equation.zoo.diffusion_reaction_equation
diff --git a/docs/source/_rst/equation/zoo/fixed_flux.rst b/docs/source/_rst/equation/zoo/fixed_flux.rst
index 9b81db4b2..08c390481 100644
--- a/docs/source/_rst/equation/zoo/fixed_flux.rst
+++ b/docs/source/_rst/equation/zoo/fixed_flux.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Fixed Flux
=====================
.. currentmodule:: pina.equation.zoo.fixed_flux
diff --git a/docs/source/_rst/equation/zoo/fixed_gradient.rst b/docs/source/_rst/equation/zoo/fixed_gradient.rst
index f8da5dea8..034a4e602 100644
--- a/docs/source/_rst/equation/zoo/fixed_gradient.rst
+++ b/docs/source/_rst/equation/zoo/fixed_gradient.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Fixed Gradient
=====================
.. currentmodule:: pina.equation.zoo.fixed_gradient
diff --git a/docs/source/_rst/equation/zoo/fixed_laplacian.rst b/docs/source/_rst/equation/zoo/fixed_laplacian.rst
index 3123918a6..f066ed73a 100644
--- a/docs/source/_rst/equation/zoo/fixed_laplacian.rst
+++ b/docs/source/_rst/equation/zoo/fixed_laplacian.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Fixed Laplacian
=====================
.. currentmodule:: pina.equation.zoo.fixed_laplacian
diff --git a/docs/source/_rst/equation/zoo/fixed_value.rst b/docs/source/_rst/equation/zoo/fixed_value.rst
index 29eaa0521..bf11cce66 100644
--- a/docs/source/_rst/equation/zoo/fixed_value.rst
+++ b/docs/source/_rst/equation/zoo/fixed_value.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Fixed Value
=====================
.. currentmodule:: pina.equation.zoo.fixed_value
diff --git a/docs/source/_rst/equation/zoo/helmholtz_equation.rst b/docs/source/_rst/equation/zoo/helmholtz_equation.rst
index 7728b60ed..5b8c087c8 100644
--- a/docs/source/_rst/equation/zoo/helmholtz_equation.rst
+++ b/docs/source/_rst/equation/zoo/helmholtz_equation.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Helmholtz Equation
=====================
.. currentmodule:: pina.equation.zoo.helmholtz_equation
diff --git a/docs/source/_rst/equation/zoo/poisson_equation.rst b/docs/source/_rst/equation/zoo/poisson_equation.rst
index f23796450..d70e406ba 100644
--- a/docs/source/_rst/equation/zoo/poisson_equation.rst
+++ b/docs/source/_rst/equation/zoo/poisson_equation.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Poisson Equation
=====================
.. currentmodule:: pina.equation.zoo.poisson_equation
diff --git a/docs/source/_rst/graph/graph.rst b/docs/source/_rst/graph/graph.rst
index 58180f50f..7b6145422 100644
--- a/docs/source/_rst/graph/graph.rst
+++ b/docs/source/_rst/graph/graph.rst
@@ -1,8 +1,11 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Graph
===========
.. currentmodule:: pina.graph
-
.. autoclass:: pina._src.core.graph.Graph
:members:
:private-members:
diff --git a/docs/source/_rst/graph/graph_builder.rst b/docs/source/_rst/graph/graph_builder.rst
index f576fe7c7..818be6126 100644
--- a/docs/source/_rst/graph/graph_builder.rst
+++ b/docs/source/_rst/graph/graph_builder.rst
@@ -1,8 +1,11 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
GraphBuilder
==============
.. currentmodule:: pina.graph
-
.. autoclass:: pina._src.core.graph.GraphBuilder
:members:
:private-members:
diff --git a/docs/source/_rst/graph/knn_graph.rst b/docs/source/_rst/graph/knn_graph.rst
index e31a004ab..f76222cff 100644
--- a/docs/source/_rst/graph/knn_graph.rst
+++ b/docs/source/_rst/graph/knn_graph.rst
@@ -1,8 +1,11 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
KNNGraph
===========
.. currentmodule:: pina.graph
-
.. autoclass:: pina._src.core.graph.KNNGraph
:members:
:private-members:
diff --git a/docs/source/_rst/graph/label_batch.rst b/docs/source/_rst/graph/label_batch.rst
index 5a68bde60..f528afa31 100644
--- a/docs/source/_rst/graph/label_batch.rst
+++ b/docs/source/_rst/graph/label_batch.rst
@@ -1,8 +1,11 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
LabelBatch
===========
.. currentmodule:: pina.graph
-
.. autoclass:: pina._src.core.graph.LabelBatch
:members:
:private-members:
diff --git a/docs/source/_rst/graph/radius_graph.rst b/docs/source/_rst/graph/radius_graph.rst
index 9db9fb174..beac545de 100644
--- a/docs/source/_rst/graph/radius_graph.rst
+++ b/docs/source/_rst/graph/radius_graph.rst
@@ -1,8 +1,11 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
RadiusGraph
=============
.. currentmodule:: pina.graph
-
.. autoclass:: pina._src.core.graph.RadiusGraph
:members:
:private-members:
diff --git a/docs/source/_rst/label_tensor.rst b/docs/source/_rst/label_tensor.rst
index 1b750ad97..5de5eecc0 100644
--- a/docs/source/_rst/label_tensor.rst
+++ b/docs/source/_rst/label_tensor.rst
@@ -1,12 +1,30 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
LabelTensor
===========
+
+A :class:`~pina._src.core.label_tensor.LabelTensor` extends :class:`torch.Tensor` with named labels for each dimension.
+This allows intuitive indexing by name (e.g. ``tensor.labels``) and is the fundamental data structure used throughout PINA
+for passing multi-physics solution fields between components.
+
+Use a :class:`~pina._src.core.label_tensor.LabelTensor` whenever you need to keep track of which
+variable corresponds to which column in a tensor — for example, when a model outputs both temperature and pressure,
+or when a domain has spatial coordinates ``x``, ``y``, ``z``.
+
.. currentmodule:: pina.label_tensor
.. automodule:: pina._src.core.label_tensor
- :no-members:
-
+ :no-members:
.. autoclass:: pina._src.core.label_tensor.LabelTensor
:members:
:private-members:
- :show-inheritance:
\ No newline at end of file
+ :show-inheritance:
+
+See Also
+--------
+
+* :class:`~pina.graph.Graph`
+* :doc:`Data module <../_rst/data/data_module>`
diff --git a/docs/source/_rst/loss/base_dual_loss.rst b/docs/source/_rst/loss/base_dual_loss.rst
index 8037f894b..cf7523159 100644
--- a/docs/source/_rst/loss/base_dual_loss.rst
+++ b/docs/source/_rst/loss/base_dual_loss.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Base Dual Loss
================
.. currentmodule:: pina.loss.base_dual_loss
diff --git a/docs/source/_rst/loss/dual_loss_interface.rst b/docs/source/_rst/loss/dual_loss_interface.rst
index a6a005914..c9663cb5b 100644
--- a/docs/source/_rst/loss/dual_loss_interface.rst
+++ b/docs/source/_rst/loss/dual_loss_interface.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Dual Loss Interface
===================
.. currentmodule:: pina.loss.dual_loss_interface
diff --git a/docs/source/_rst/loss/lp_loss.rst b/docs/source/_rst/loss/lp_loss.rst
index 4924d3445..b1b6f4978 100644
--- a/docs/source/_rst/loss/lp_loss.rst
+++ b/docs/source/_rst/loss/lp_loss.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Lp Loss
===============
.. currentmodule:: pina.loss.lp_loss
diff --git a/docs/source/_rst/loss/power_loss.rst b/docs/source/_rst/loss/power_loss.rst
index a0258c20f..e7a38ba53 100644
--- a/docs/source/_rst/loss/power_loss.rst
+++ b/docs/source/_rst/loss/power_loss.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Power Loss
====================
.. currentmodule:: pina.loss.power_loss
diff --git a/docs/source/_rst/loss/sinkhorn_loss.rst b/docs/source/_rst/loss/sinkhorn_loss.rst
index 17aa370ad..283937d85 100644
--- a/docs/source/_rst/loss/sinkhorn_loss.rst
+++ b/docs/source/_rst/loss/sinkhorn_loss.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Sinkhorn Loss
===============
diff --git a/docs/source/_rst/model/average_neural_operator.rst b/docs/source/_rst/model/average_neural_operator.rst
index a54107620..709b8605c 100644
--- a/docs/source/_rst/model/average_neural_operator.rst
+++ b/docs/source/_rst/model/average_neural_operator.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Averaging Neural Operator
==============================
.. currentmodule:: pina.model.average_neural_operator
diff --git a/docs/source/_rst/model/block/average_neural_operator_block.rst b/docs/source/_rst/model/block/average_neural_operator_block.rst
index 1e38fc215..fff83de5e 100644
--- a/docs/source/_rst/model/block/average_neural_operator_block.rst
+++ b/docs/source/_rst/model/block/average_neural_operator_block.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Averaging Neural Operator Block
==================================
.. currentmodule:: pina.model.block.average_neural_operator_block
diff --git a/docs/source/_rst/model/block/convolution.rst b/docs/source/_rst/model/block/convolution.rst
index bd0d32e71..785b1df4f 100644
--- a/docs/source/_rst/model/block/convolution.rst
+++ b/docs/source/_rst/model/block/convolution.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Continuous Convolution Block
===============================
.. currentmodule:: pina.model.block.convolution_2d
diff --git a/docs/source/_rst/model/block/convolution_interface.rst b/docs/source/_rst/model/block/convolution_interface.rst
index c6708ca94..360cc0f2e 100644
--- a/docs/source/_rst/model/block/convolution_interface.rst
+++ b/docs/source/_rst/model/block/convolution_interface.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Continuous Convolution Interface
==================================
.. currentmodule:: pina.model.block.convolution
diff --git a/docs/source/_rst/model/block/enhanced_linear.rst b/docs/source/_rst/model/block/enhanced_linear.rst
index 92e8d5581..6d3332df1 100644
--- a/docs/source/_rst/model/block/enhanced_linear.rst
+++ b/docs/source/_rst/model/block/enhanced_linear.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
EnhancedLinear Block
=====================
.. currentmodule:: pina.model.block.residual
diff --git a/docs/source/_rst/model/block/fourier_block.rst b/docs/source/_rst/model/block/fourier_block.rst
index 9b601bb3d..c2b289b8c 100644
--- a/docs/source/_rst/model/block/fourier_block.rst
+++ b/docs/source/_rst/model/block/fourier_block.rst
@@ -1,8 +1,11 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Fourier Neural Operator Block
======================================
.. currentmodule:: pina.model.block.fourier_block
-
.. autoclass:: pina._src.model.block.fourier_block.FourierBlock1D
:members:
:show-inheritance:
diff --git a/docs/source/_rst/model/block/fourier_embedding.rst b/docs/source/_rst/model/block/fourier_embedding.rst
index 48c8df41c..e2d70ab02 100644
--- a/docs/source/_rst/model/block/fourier_embedding.rst
+++ b/docs/source/_rst/model/block/fourier_embedding.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Fourier Feature Embedding
=======================================
.. currentmodule:: pina.model.block.embedding
diff --git a/docs/source/_rst/model/block/gno_block.rst b/docs/source/_rst/model/block/gno_block.rst
index 8ce3f2f30..d84f06271 100644
--- a/docs/source/_rst/model/block/gno_block.rst
+++ b/docs/source/_rst/model/block/gno_block.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Graph Neural Operator Block
===============================
.. currentmodule:: pina.model.block.gno_block
diff --git a/docs/source/_rst/model/block/kan_block.rst b/docs/source/_rst/model/block/kan_block.rst
index 95ca239eb..9b361dada 100644
--- a/docs/source/_rst/model/block/kan_block.rst
+++ b/docs/source/_rst/model/block/kan_block.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
KANBlock
=======================
.. currentmodule:: pina.model.block.kan_block
diff --git a/docs/source/_rst/model/block/low_rank_block.rst b/docs/source/_rst/model/block/low_rank_block.rst
index 83c7a11a0..617f48918 100644
--- a/docs/source/_rst/model/block/low_rank_block.rst
+++ b/docs/source/_rst/model/block/low_rank_block.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Low Rank Neural Operator Block
=================================
.. currentmodule:: pina.model.block.low_rank_block
diff --git a/docs/source/_rst/model/block/message_passing/deep_tensor_network_block.rst b/docs/source/_rst/model/block/message_passing/deep_tensor_network_block.rst
index 51482496a..4d3a392d0 100644
--- a/docs/source/_rst/model/block/message_passing/deep_tensor_network_block.rst
+++ b/docs/source/_rst/model/block/message_passing/deep_tensor_network_block.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Deep Tensor Network Block
==================================
.. currentmodule:: pina.model.block.message_passing.deep_tensor_network_block
diff --git a/docs/source/_rst/model/block/message_passing/en_equivariant_network_block.rst b/docs/source/_rst/model/block/message_passing/en_equivariant_network_block.rst
index 09966ea0a..8baa09432 100644
--- a/docs/source/_rst/model/block/message_passing/en_equivariant_network_block.rst
+++ b/docs/source/_rst/model/block/message_passing/en_equivariant_network_block.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
E(n) Equivariant Network Block
==================================
.. currentmodule:: pina.model.block.message_passing.en_equivariant_network_block
diff --git a/docs/source/_rst/model/block/message_passing/equivariant_graph_neural_operator_block.rst b/docs/source/_rst/model/block/message_passing/equivariant_graph_neural_operator_block.rst
index b61c4f430..9bd6c8ad1 100644
--- a/docs/source/_rst/model/block/message_passing/equivariant_graph_neural_operator_block.rst
+++ b/docs/source/_rst/model/block/message_passing/equivariant_graph_neural_operator_block.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
EquivariantGraphNeuralOperatorBlock
=====================================
.. currentmodule:: pina.model.block.message_passing.equivariant_graph_neural_operator_block
diff --git a/docs/source/_rst/model/block/message_passing/interaction_network_block.rst b/docs/source/_rst/model/block/message_passing/interaction_network_block.rst
index a4c86e562..4317a37df 100644
--- a/docs/source/_rst/model/block/message_passing/interaction_network_block.rst
+++ b/docs/source/_rst/model/block/message_passing/interaction_network_block.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Interaction Network Block
==================================
.. currentmodule:: pina.model.block.message_passing.interaction_network_block
diff --git a/docs/source/_rst/model/block/message_passing/radial_field_network_block.rst b/docs/source/_rst/model/block/message_passing/radial_field_network_block.rst
index bb66ee770..612198053 100644
--- a/docs/source/_rst/model/block/message_passing/radial_field_network_block.rst
+++ b/docs/source/_rst/model/block/message_passing/radial_field_network_block.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Radial Field Network Block
==================================
.. currentmodule:: pina.model.block.message_passing.radial_field_network_block
diff --git a/docs/source/_rst/model/block/orthogonal.rst b/docs/source/_rst/model/block/orthogonal.rst
index a9fc727fb..4a31c322a 100644
--- a/docs/source/_rst/model/block/orthogonal.rst
+++ b/docs/source/_rst/model/block/orthogonal.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Orthogonal Block
======================
.. currentmodule:: pina.model.block.orthogonal
diff --git a/docs/source/_rst/model/block/pbc_embedding.rst b/docs/source/_rst/model/block/pbc_embedding.rst
index e79ae9514..52d0f88da 100644
--- a/docs/source/_rst/model/block/pbc_embedding.rst
+++ b/docs/source/_rst/model/block/pbc_embedding.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Periodic Boundary Condition Embedding
=======================================
.. currentmodule:: pina.model.block.embedding
diff --git a/docs/source/_rst/model/block/pirate_network_block.rst b/docs/source/_rst/model/block/pirate_network_block.rst
index f534d3cb0..0a54c4828 100644
--- a/docs/source/_rst/model/block/pirate_network_block.rst
+++ b/docs/source/_rst/model/block/pirate_network_block.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
PirateNet Block
=======================================
.. currentmodule:: pina.model.block.pirate_network_block
diff --git a/docs/source/_rst/model/block/pod_block.rst b/docs/source/_rst/model/block/pod_block.rst
index 98fadbb1e..590a3b116 100644
--- a/docs/source/_rst/model/block/pod_block.rst
+++ b/docs/source/_rst/model/block/pod_block.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Proper Orthogonal Decomposition Block
============================================
.. currentmodule:: pina.model.block.pod_block
diff --git a/docs/source/_rst/model/block/rbf_block.rst b/docs/source/_rst/model/block/rbf_block.rst
index b8997d21b..935ad7897 100644
--- a/docs/source/_rst/model/block/rbf_block.rst
+++ b/docs/source/_rst/model/block/rbf_block.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Radias Basis Function Block
=============================
.. currentmodule:: pina.model.block.rbf_block
diff --git a/docs/source/_rst/model/block/residual.rst b/docs/source/_rst/model/block/residual.rst
index d0e478563..6de4f549d 100644
--- a/docs/source/_rst/model/block/residual.rst
+++ b/docs/source/_rst/model/block/residual.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Residual Block
===================
.. currentmodule:: pina.model.block.residual
diff --git a/docs/source/_rst/model/block/spectral.rst b/docs/source/_rst/model/block/spectral.rst
index 1ee0e1d19..1d44055df 100644
--- a/docs/source/_rst/model/block/spectral.rst
+++ b/docs/source/_rst/model/block/spectral.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Spectral Convolution Block
============================
.. currentmodule:: pina.model.block.spectral
diff --git a/docs/source/_rst/model/deeponet.rst b/docs/source/_rst/model/deeponet.rst
index eef25dcae..35cba13b1 100644
--- a/docs/source/_rst/model/deeponet.rst
+++ b/docs/source/_rst/model/deeponet.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
DeepONet
===========
.. currentmodule:: pina.model.deeponet
diff --git a/docs/source/_rst/model/equivariant_graph_neural_operator.rst b/docs/source/_rst/model/equivariant_graph_neural_operator.rst
index e100f5c1e..f1e6e3a96 100644
--- a/docs/source/_rst/model/equivariant_graph_neural_operator.rst
+++ b/docs/source/_rst/model/equivariant_graph_neural_operator.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
EquivariantGraphNeuralOperator
=================================
.. currentmodule:: pina.model.equivariant_graph_neural_operator
diff --git a/docs/source/_rst/model/feed_forward.rst b/docs/source/_rst/model/feed_forward.rst
index be75ed70b..d311295ac 100644
--- a/docs/source/_rst/model/feed_forward.rst
+++ b/docs/source/_rst/model/feed_forward.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
FeedForward
======================
.. currentmodule:: pina.model.feed_forward
diff --git a/docs/source/_rst/model/fourier_integral_kernel.rst b/docs/source/_rst/model/fourier_integral_kernel.rst
index dba63c429..920ab8ad6 100644
--- a/docs/source/_rst/model/fourier_integral_kernel.rst
+++ b/docs/source/_rst/model/fourier_integral_kernel.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
FourierIntegralKernel
=========================
.. currentmodule:: pina.model.fourier_neural_operator
diff --git a/docs/source/_rst/model/fourier_neural_operator.rst b/docs/source/_rst/model/fourier_neural_operator.rst
index 14cb52667..155d5ea77 100644
--- a/docs/source/_rst/model/fourier_neural_operator.rst
+++ b/docs/source/_rst/model/fourier_neural_operator.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
FNO
===========
.. currentmodule:: pina.model.fourier_neural_operator
diff --git a/docs/source/_rst/model/graph_neural_operator.rst b/docs/source/_rst/model/graph_neural_operator.rst
index 7f7b7ed6b..b5a01bfd1 100644
--- a/docs/source/_rst/model/graph_neural_operator.rst
+++ b/docs/source/_rst/model/graph_neural_operator.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
GraphNeuralOperator
=======================
.. currentmodule:: pina.model.graph_neural_operator
diff --git a/docs/source/_rst/model/graph_neural_operator_integral_kernel.rst b/docs/source/_rst/model/graph_neural_operator_integral_kernel.rst
index 45f78c366..966ffd8a7 100644
--- a/docs/source/_rst/model/graph_neural_operator_integral_kernel.rst
+++ b/docs/source/_rst/model/graph_neural_operator_integral_kernel.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
GraphNeuralKernel
=======================
.. currentmodule:: pina.model.graph_neural_operator
diff --git a/docs/source/_rst/model/kernel_neural_operator.rst b/docs/source/_rst/model/kernel_neural_operator.rst
index 75a39b223..cf09ee466 100644
--- a/docs/source/_rst/model/kernel_neural_operator.rst
+++ b/docs/source/_rst/model/kernel_neural_operator.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
KernelNeuralOperator
=======================
.. currentmodule:: pina.model.kernel_neural_operator
diff --git a/docs/source/_rst/model/kolmogorov_arnold_network.rst b/docs/source/_rst/model/kolmogorov_arnold_network.rst
index 0211611f4..bfbd4d84e 100644
--- a/docs/source/_rst/model/kolmogorov_arnold_network.rst
+++ b/docs/source/_rst/model/kolmogorov_arnold_network.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
KolmogorovArnoldNetwork
===========================
.. currentmodule:: pina.model.kolmogorov_arnold_network
diff --git a/docs/source/_rst/model/low_rank_neural_operator.rst b/docs/source/_rst/model/low_rank_neural_operator.rst
index e0362d144..74dc7dc2d 100644
--- a/docs/source/_rst/model/low_rank_neural_operator.rst
+++ b/docs/source/_rst/model/low_rank_neural_operator.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Low Rank Neural Operator
==============================
.. currentmodule:: pina.model.low_rank_neural_operator
diff --git a/docs/source/_rst/model/mionet.rst b/docs/source/_rst/model/mionet.rst
index 1888d911e..6708dfa38 100644
--- a/docs/source/_rst/model/mionet.rst
+++ b/docs/source/_rst/model/mionet.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
MIONet
===========
.. currentmodule:: pina.model.deeponet
diff --git a/docs/source/_rst/model/multi_feed_forward.rst b/docs/source/_rst/model/multi_feed_forward.rst
index 458173ced..09beca89d 100644
--- a/docs/source/_rst/model/multi_feed_forward.rst
+++ b/docs/source/_rst/model/multi_feed_forward.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
MultiFeedForward
==================
.. currentmodule:: pina.model.multi_feed_forward
diff --git a/docs/source/_rst/model/pirate_network.rst b/docs/source/_rst/model/pirate_network.rst
index a60449a6c..dddd90e27 100644
--- a/docs/source/_rst/model/pirate_network.rst
+++ b/docs/source/_rst/model/pirate_network.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
PirateNet
=======================
.. currentmodule:: pina.model.pirate_network
diff --git a/docs/source/_rst/model/residual_feed_forward.rst b/docs/source/_rst/model/residual_feed_forward.rst
index d8ce08152..ff8e001e7 100644
--- a/docs/source/_rst/model/residual_feed_forward.rst
+++ b/docs/source/_rst/model/residual_feed_forward.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
ResidualFeedForward
======================
.. currentmodule:: pina.model.feed_forward
diff --git a/docs/source/_rst/model/sindy.rst b/docs/source/_rst/model/sindy.rst
index f07ca6d30..3588b7774 100644
--- a/docs/source/_rst/model/sindy.rst
+++ b/docs/source/_rst/model/sindy.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
SINDy
=======================
.. currentmodule:: pina.model.sindy
diff --git a/docs/source/_rst/model/spline.rst b/docs/source/_rst/model/spline.rst
index 278a95d3b..948f0c302 100644
--- a/docs/source/_rst/model/spline.rst
+++ b/docs/source/_rst/model/spline.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Spline
========
.. currentmodule:: pina.model.spline
diff --git a/docs/source/_rst/model/spline_surface.rst b/docs/source/_rst/model/spline_surface.rst
index 9b204cd22..515d9dd16 100644
--- a/docs/source/_rst/model/spline_surface.rst
+++ b/docs/source/_rst/model/spline_surface.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Spline Surface
================
.. currentmodule:: pina.model.spline_surface
diff --git a/docs/source/_rst/model/vectorized_spline.rst b/docs/source/_rst/model/vectorized_spline.rst
index 08522bc54..4cc4bb45c 100644
--- a/docs/source/_rst/model/vectorized_spline.rst
+++ b/docs/source/_rst/model/vectorized_spline.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
VectorizedSpline
=======================
.. currentmodule:: pina.model.vectorized_spline
diff --git a/docs/source/_rst/operator.rst b/docs/source/_rst/operator.rst
index fe0ad0398..a335d724a 100644
--- a/docs/source/_rst/operator.rst
+++ b/docs/source/_rst/operator.rst
@@ -1,9 +1,33 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Operators
-===========
+=========
-.. currentmodule:: pina.operator
+Differential operators are used in PINA to compute spatial and temporal derivatives of neural network outputs.
+They are essential for defining PDE residuals in PINN-based solvers.
+
+The following operators are available:
+
+* :func:`~pina.operator.grad` — Gradient of a scalar field.
+* :func:`~pina.operator.div` — Divergence of a vector field.
+* :func:`~pina.operator.laplacian` — Laplacian of a scalar field.
+* :func:`~pina.operator.advection` — Advection operator.
+* ``fast_grad``, ``fast_div``, ``fast_laplacian``, ``fast_advection`` — Optimised variants for performance.
+.. currentmodule:: pina.operator
.. automodule:: pina._src.core.operator
- :members:
- :show-inheritance:
\ No newline at end of file
+ :members:
+ :show-inheritance:
+
+.. note::
+
+ All operators work with :class:`~pina.label_tensor.LabelTensor` inputs and respect label-based indexing.
+
+See Also
+--------
+
+* :class:`~pina.equation.equation.Equation`
+* :class:`~pina.equation.equation_factory.Poisson`
diff --git a/docs/source/_rst/optim/optimizer_interface.rst b/docs/source/_rst/optim/optimizer_interface.rst
index 23a933bae..c9648e279 100644
--- a/docs/source/_rst/optim/optimizer_interface.rst
+++ b/docs/source/_rst/optim/optimizer_interface.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Optimizer Interface
=====================
.. currentmodule:: pina.optim.optimizer_interface
diff --git a/docs/source/_rst/optim/scheduler_interface.rst b/docs/source/_rst/optim/scheduler_interface.rst
index 03b3e83f7..ea9354852 100644
--- a/docs/source/_rst/optim/scheduler_interface.rst
+++ b/docs/source/_rst/optim/scheduler_interface.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Scheduler Interface
=====================
.. currentmodule:: pina.optim.scheduler_interface
diff --git a/docs/source/_rst/optim/torch_optimizer.rst b/docs/source/_rst/optim/torch_optimizer.rst
index 54bfe9a3a..b23943149 100644
--- a/docs/source/_rst/optim/torch_optimizer.rst
+++ b/docs/source/_rst/optim/torch_optimizer.rst
@@ -1,4 +1,8 @@
-Torch Optimizer
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
+TorchOptimizer
===============
.. currentmodule:: pina.optim.torch_optimizer
diff --git a/docs/source/_rst/optim/torch_scheduler.rst b/docs/source/_rst/optim/torch_scheduler.rst
index 59260533e..86439e263 100644
--- a/docs/source/_rst/optim/torch_scheduler.rst
+++ b/docs/source/_rst/optim/torch_scheduler.rst
@@ -1,4 +1,8 @@
-Torch Scheduler
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
+TorchScheduler
===============
.. currentmodule:: pina.optim.torch_scheduler
diff --git a/docs/source/_rst/problem/base_problem.rst b/docs/source/_rst/problem/base_problem.rst
index 2261a90f7..d5be5bac1 100644
--- a/docs/source/_rst/problem/base_problem.rst
+++ b/docs/source/_rst/problem/base_problem.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Base Problem
===============
.. currentmodule:: pina.problem.base_problem
diff --git a/docs/source/_rst/problem/inverse_problem.rst b/docs/source/_rst/problem/inverse_problem.rst
index 4b5de05cb..b8eaace3b 100644
--- a/docs/source/_rst/problem/inverse_problem.rst
+++ b/docs/source/_rst/problem/inverse_problem.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
InverseProblem
==============
.. currentmodule:: pina.problem.inverse_problem
diff --git a/docs/source/_rst/problem/parametric_problem.rst b/docs/source/_rst/problem/parametric_problem.rst
index 1a5e83490..ec33b49e8 100644
--- a/docs/source/_rst/problem/parametric_problem.rst
+++ b/docs/source/_rst/problem/parametric_problem.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
ParametricProblem
====================
.. currentmodule:: pina.problem.parametric_problem
diff --git a/docs/source/_rst/problem/problem_interface.rst b/docs/source/_rst/problem/problem_interface.rst
index 08136e23c..62c5227a0 100644
--- a/docs/source/_rst/problem/problem_interface.rst
+++ b/docs/source/_rst/problem/problem_interface.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
ProblemInterface
===================
.. currentmodule:: pina.problem.problem_interface
diff --git a/docs/source/_rst/problem/spatial_problem.rst b/docs/source/_rst/problem/spatial_problem.rst
index 757243ef1..36a2134cf 100644
--- a/docs/source/_rst/problem/spatial_problem.rst
+++ b/docs/source/_rst/problem/spatial_problem.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
SpatialProblem
==============
.. currentmodule:: pina.problem.spatial_problem
diff --git a/docs/source/_rst/problem/time_dependent_problem.rst b/docs/source/_rst/problem/time_dependent_problem.rst
index dda1e07f1..d98cf488f 100644
--- a/docs/source/_rst/problem/time_dependent_problem.rst
+++ b/docs/source/_rst/problem/time_dependent_problem.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
TimeDependentProblem
====================
.. currentmodule:: pina.problem.time_dependent_problem
diff --git a/docs/source/_rst/problem/zoo/acoustic_wave_problem.rst b/docs/source/_rst/problem/zoo/acoustic_wave_problem.rst
index c6acb93f1..f14c93a1f 100644
--- a/docs/source/_rst/problem/zoo/acoustic_wave_problem.rst
+++ b/docs/source/_rst/problem/zoo/acoustic_wave_problem.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
AcousticWaveProblem
=====================
.. currentmodule:: pina.problem.zoo.acoustic_wave_problem
diff --git a/docs/source/_rst/problem/zoo/advection_problem.rst b/docs/source/_rst/problem/zoo/advection_problem.rst
index df37679cb..8249ba8d7 100644
--- a/docs/source/_rst/problem/zoo/advection_problem.rst
+++ b/docs/source/_rst/problem/zoo/advection_problem.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
AdvectionProblem
==================
.. currentmodule:: pina.problem.zoo.advection_problem
diff --git a/docs/source/_rst/problem/zoo/allen_cahn_problem.rst b/docs/source/_rst/problem/zoo/allen_cahn_problem.rst
index 463be3a55..026bd3f92 100644
--- a/docs/source/_rst/problem/zoo/allen_cahn_problem.rst
+++ b/docs/source/_rst/problem/zoo/allen_cahn_problem.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
AllenCahnProblem
==================
.. currentmodule:: pina.problem.zoo.allen_cahn_problem
diff --git a/docs/source/_rst/problem/zoo/burgers_problem.rst b/docs/source/_rst/problem/zoo/burgers_problem.rst
index 75151d8d8..f2cd9a4fd 100644
--- a/docs/source/_rst/problem/zoo/burgers_problem.rst
+++ b/docs/source/_rst/problem/zoo/burgers_problem.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Burgers' Problem
=====================
.. currentmodule:: pina.problem.zoo.burgers_problem
diff --git a/docs/source/_rst/problem/zoo/diffusion_reaction_problem.rst b/docs/source/_rst/problem/zoo/diffusion_reaction_problem.rst
index 307a56c52..c2f252a84 100644
--- a/docs/source/_rst/problem/zoo/diffusion_reaction_problem.rst
+++ b/docs/source/_rst/problem/zoo/diffusion_reaction_problem.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
DiffusionReactionProblem
=========================
.. currentmodule:: pina.problem.zoo.diffusion_reaction_problem
diff --git a/docs/source/_rst/problem/zoo/helmholtz_problem.rst b/docs/source/_rst/problem/zoo/helmholtz_problem.rst
index 952578a2b..7ab06b52e 100644
--- a/docs/source/_rst/problem/zoo/helmholtz_problem.rst
+++ b/docs/source/_rst/problem/zoo/helmholtz_problem.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
HelmholtzProblem
==================
.. currentmodule:: pina.problem.zoo.helmholtz_problem
diff --git a/docs/source/_rst/problem/zoo/inverse_poisson_problem.rst b/docs/source/_rst/problem/zoo/inverse_poisson_problem.rst
index 503eb21bf..3c20e9cea 100644
--- a/docs/source/_rst/problem/zoo/inverse_poisson_problem.rst
+++ b/docs/source/_rst/problem/zoo/inverse_poisson_problem.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
InversePoisson2DSquareProblem
==============================
.. currentmodule:: pina.problem.zoo.inverse_poisson_problem
diff --git a/docs/source/_rst/problem/zoo/poisson_problem.rst b/docs/source/_rst/problem/zoo/poisson_problem.rst
index a480a8953..761077a8e 100644
--- a/docs/source/_rst/problem/zoo/poisson_problem.rst
+++ b/docs/source/_rst/problem/zoo/poisson_problem.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Poisson2DSquareProblem
========================
.. currentmodule:: pina.problem.zoo.poisson_problem
diff --git a/docs/source/_rst/problem/zoo/supervised_problem.rst b/docs/source/_rst/problem/zoo/supervised_problem.rst
index 6bf368376..b6131a35f 100644
--- a/docs/source/_rst/problem/zoo/supervised_problem.rst
+++ b/docs/source/_rst/problem/zoo/supervised_problem.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
SupervisedProblem
==================
.. currentmodule:: pina.problem.zoo.supervised_problem
diff --git a/docs/source/_rst/solver/autoregressive_ensemble_solver.rst b/docs/source/_rst/solver/autoregressive_ensemble_solver.rst
index ba90c826f..3e59bd8f4 100644
--- a/docs/source/_rst/solver/autoregressive_ensemble_solver.rst
+++ b/docs/source/_rst/solver/autoregressive_ensemble_solver.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Autoregressive Ensemble Solver
=================================
.. currentmodule:: pina.solver.autoregressive_ensemble_solver
diff --git a/docs/source/_rst/solver/autoregressive_single_model_solver.rst b/docs/source/_rst/solver/autoregressive_single_model_solver.rst
index 217c1ff59..643770c8b 100644
--- a/docs/source/_rst/solver/autoregressive_single_model_solver.rst
+++ b/docs/source/_rst/solver/autoregressive_single_model_solver.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Autoregressive Single Model Solver
======================================
.. currentmodule:: pina.solver.autoregressive_single_model_solver
diff --git a/docs/source/_rst/solver/base_solver.rst b/docs/source/_rst/solver/base_solver.rst
index 939b94311..d5d32a550 100644
--- a/docs/source/_rst/solver/base_solver.rst
+++ b/docs/source/_rst/solver/base_solver.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Base Solver
=================================
.. currentmodule:: pina.solver.base_solver
diff --git a/docs/source/_rst/solver/causal_physics_informed_single_model_solver.rst b/docs/source/_rst/solver/causal_physics_informed_single_model_solver.rst
index 811231ae1..8a405912c 100644
--- a/docs/source/_rst/solver/causal_physics_informed_single_model_solver.rst
+++ b/docs/source/_rst/solver/causal_physics_informed_single_model_solver.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Causal Physics Informed Single Model Solver
=================================================
diff --git a/docs/source/_rst/solver/competitive_physics_informed_solver.rst b/docs/source/_rst/solver/competitive_physics_informed_solver.rst
index 9138dca85..7992d05f4 100644
--- a/docs/source/_rst/solver/competitive_physics_informed_solver.rst
+++ b/docs/source/_rst/solver/competitive_physics_informed_solver.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Competitive Physics-Informed Solver
=======================================
diff --git a/docs/source/_rst/solver/ensemble_solver.rst b/docs/source/_rst/solver/ensemble_solver.rst
index 1031422c0..a200284e9 100644
--- a/docs/source/_rst/solver/ensemble_solver.rst
+++ b/docs/source/_rst/solver/ensemble_solver.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Ensemble Solver
=================================
.. currentmodule:: pina.solver.ensemble_solver
diff --git a/docs/source/_rst/solver/gradient_physics_informed_single_model_solver.rst b/docs/source/_rst/solver/gradient_physics_informed_single_model_solver.rst
index b602d2277..18fd8a082 100644
--- a/docs/source/_rst/solver/gradient_physics_informed_single_model_solver.rst
+++ b/docs/source/_rst/solver/gradient_physics_informed_single_model_solver.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Gradient Physics Informed Single Model Solver
=================================================
diff --git a/docs/source/_rst/solver/mixin/autoregressive_mixin.rst b/docs/source/_rst/solver/mixin/autoregressive_mixin.rst
index fee7df2ac..04d0ab9f6 100644
--- a/docs/source/_rst/solver/mixin/autoregressive_mixin.rst
+++ b/docs/source/_rst/solver/mixin/autoregressive_mixin.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Autoregressive Mixin
=================================
diff --git a/docs/source/_rst/solver/mixin/condition_aggregator_mixin.rst b/docs/source/_rst/solver/mixin/condition_aggregator_mixin.rst
index 4868edff1..6236c5d6f 100644
--- a/docs/source/_rst/solver/mixin/condition_aggregator_mixin.rst
+++ b/docs/source/_rst/solver/mixin/condition_aggregator_mixin.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Condition Aggregator Mixin
=================================
diff --git a/docs/source/_rst/solver/mixin/ensemble_mixin.rst b/docs/source/_rst/solver/mixin/ensemble_mixin.rst
index d3548e745..74e0a1b19 100644
--- a/docs/source/_rst/solver/mixin/ensemble_mixin.rst
+++ b/docs/source/_rst/solver/mixin/ensemble_mixin.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Ensemble Mixin
=================================
diff --git a/docs/source/_rst/solver/mixin/gradient_enhanced_mixin.rst b/docs/source/_rst/solver/mixin/gradient_enhanced_mixin.rst
index f9ab310b6..c463f0ab4 100644
--- a/docs/source/_rst/solver/mixin/gradient_enhanced_mixin.rst
+++ b/docs/source/_rst/solver/mixin/gradient_enhanced_mixin.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Gradient-Enhanced Mixin
=================================
diff --git a/docs/source/_rst/solver/mixin/manual_optimization_mixin.rst b/docs/source/_rst/solver/mixin/manual_optimization_mixin.rst
index 5974aa222..864642164 100644
--- a/docs/source/_rst/solver/mixin/manual_optimization_mixin.rst
+++ b/docs/source/_rst/solver/mixin/manual_optimization_mixin.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Manual Optimization Mixin
=================================
diff --git a/docs/source/_rst/solver/mixin/multi_model_mixin.rst b/docs/source/_rst/solver/mixin/multi_model_mixin.rst
index 0302d1883..3af1f7763 100644
--- a/docs/source/_rst/solver/mixin/multi_model_mixin.rst
+++ b/docs/source/_rst/solver/mixin/multi_model_mixin.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Multi-Model Mixin
=================================
diff --git a/docs/source/_rst/solver/mixin/physics_informed_mixin.rst b/docs/source/_rst/solver/mixin/physics_informed_mixin.rst
index 8503d9cbc..9a0103350 100644
--- a/docs/source/_rst/solver/mixin/physics_informed_mixin.rst
+++ b/docs/source/_rst/solver/mixin/physics_informed_mixin.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Physics-Informed Mixin
=================================
diff --git a/docs/source/_rst/solver/mixin/residual_based_attention_mixin.rst b/docs/source/_rst/solver/mixin/residual_based_attention_mixin.rst
index 768c108a8..0b3609d73 100644
--- a/docs/source/_rst/solver/mixin/residual_based_attention_mixin.rst
+++ b/docs/source/_rst/solver/mixin/residual_based_attention_mixin.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Residual-Based Attention Mixin
=================================
diff --git a/docs/source/_rst/solver/mixin/single_model_mixin.rst b/docs/source/_rst/solver/mixin/single_model_mixin.rst
index c7c665793..45075cdad 100644
--- a/docs/source/_rst/solver/mixin/single_model_mixin.rst
+++ b/docs/source/_rst/solver/mixin/single_model_mixin.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Single-Model Mixin
=================================
diff --git a/docs/source/_rst/solver/multi_model_solver.rst b/docs/source/_rst/solver/multi_model_solver.rst
index 37e1cf4df..e28601b9c 100644
--- a/docs/source/_rst/solver/multi_model_solver.rst
+++ b/docs/source/_rst/solver/multi_model_solver.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Multi Model Solver
=================================
.. currentmodule:: pina.solver.multi_model_solver
diff --git a/docs/source/_rst/solver/physics_informed_ensemble_solver.rst b/docs/source/_rst/solver/physics_informed_ensemble_solver.rst
index 726da79f8..d115fa319 100644
--- a/docs/source/_rst/solver/physics_informed_ensemble_solver.rst
+++ b/docs/source/_rst/solver/physics_informed_ensemble_solver.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Physics Informed Ensemble Solver
=================================
.. currentmodule:: pina.solver.physics_informed_ensemble_solver
diff --git a/docs/source/_rst/solver/physics_informed_single_model_solver.rst b/docs/source/_rst/solver/physics_informed_single_model_solver.rst
index 38f5952d6..626982e11 100644
--- a/docs/source/_rst/solver/physics_informed_single_model_solver.rst
+++ b/docs/source/_rst/solver/physics_informed_single_model_solver.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Physics Informed Single Model Solver
=======================================
.. currentmodule:: pina.solver.physics_informed_single_model_solver
diff --git a/docs/source/_rst/solver/rba_physics_informed_single_model_solver.rst b/docs/source/_rst/solver/rba_physics_informed_single_model_solver.rst
index 7765d2d95..f7240da39 100644
--- a/docs/source/_rst/solver/rba_physics_informed_single_model_solver.rst
+++ b/docs/source/_rst/solver/rba_physics_informed_single_model_solver.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
RBA Physics-Informed Single-Model Solver
=================================================
diff --git a/docs/source/_rst/solver/self_adaptive_physics_informed_solver.rst b/docs/source/_rst/solver/self_adaptive_physics_informed_solver.rst
index 901520e1b..65f8cdcf5 100644
--- a/docs/source/_rst/solver/self_adaptive_physics_informed_solver.rst
+++ b/docs/source/_rst/solver/self_adaptive_physics_informed_solver.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Self-Adaptive Physics-Informed Solver
=======================================
diff --git a/docs/source/_rst/solver/single_model_solver.rst b/docs/source/_rst/solver/single_model_solver.rst
index 7bb4857d5..77b95826d 100644
--- a/docs/source/_rst/solver/single_model_solver.rst
+++ b/docs/source/_rst/solver/single_model_solver.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Single Model Solver
=================================
.. currentmodule:: pina.solver.single_model_solver
diff --git a/docs/source/_rst/solver/solver_interface.rst b/docs/source/_rst/solver/solver_interface.rst
index b9f4b9e66..7a4d307ea 100644
--- a/docs/source/_rst/solver/solver_interface.rst
+++ b/docs/source/_rst/solver/solver_interface.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Solver Interface
=================================
.. currentmodule:: pina.solver.solver_interface
@@ -7,4 +11,4 @@ Solver Interface
.. autoclass:: pina._src.solver.solver_interface.SolverInterface
:members:
:show-inheritance:
- :noindex:
+ :noindex:
\ No newline at end of file
diff --git a/docs/source/_rst/solver/supervised_ensemble_solver.rst b/docs/source/_rst/solver/supervised_ensemble_solver.rst
index 23f276640..b1dcdb96b 100644
--- a/docs/source/_rst/solver/supervised_ensemble_solver.rst
+++ b/docs/source/_rst/solver/supervised_ensemble_solver.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Supervised Ensemble Solver
=================================
.. currentmodule:: pina.solver.supervised_ensemble_solver
diff --git a/docs/source/_rst/solver/supervised_single_model_solver.rst b/docs/source/_rst/solver/supervised_single_model_solver.rst
index 13c3b2fc0..21058fb0f 100644
--- a/docs/source/_rst/solver/supervised_single_model_solver.rst
+++ b/docs/source/_rst/solver/supervised_single_model_solver.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Supervised Single Model Solver
=================================
diff --git a/docs/source/_rst/trainer.rst b/docs/source/_rst/trainer.rst
index 8e5a99a38..c6459f1ce 100644
--- a/docs/source/_rst/trainer.rst
+++ b/docs/source/_rst/trainer.rst
@@ -1,8 +1,30 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
Trainer
-===========
+=======
+
+The :class:`~pina._src.core.trainer.Trainer` is the central orchestrator for model training in PINA.
+It wraps the PyTorch Lightning Trainer and adds PINA-specific data handling, batching, and compilation support.
+
+.. currentmodule:: pina.trainer
-.. automodule:: pina.trainer
+.. automodule:: pina._src.core.trainer
+ :no-members:
.. autoclass:: pina._src.core.trainer.Trainer
- :members:
- :show-inheritance:
\ No newline at end of file
+ :members:
+ :show-inheritance:
+
+.. note::
+
+ The Trainer accepts all keyword arguments from the
+ `Lightning Trainer API `_.
+
+See Also
+--------
+
+* :class:`~pina.solver.solver.SolverInterface`
+* :class:`~pina.data.data_module.PinaDataModule`
+* :doc:`Quickstart guide <../_quickstart>`
diff --git a/docs/source/_rst/weighting/base_weighting.rst b/docs/source/_rst/weighting/base_weighting.rst
index c8544697d..24bd2d0c0 100644
--- a/docs/source/_rst/weighting/base_weighting.rst
+++ b/docs/source/_rst/weighting/base_weighting.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
BaseWeighting
===================
.. currentmodule:: pina.weighting.base_weighting
diff --git a/docs/source/_rst/weighting/linear_weighting.rst b/docs/source/_rst/weighting/linear_weighting.rst
index 1941bbe80..a13f345d2 100644
--- a/docs/source/_rst/weighting/linear_weighting.rst
+++ b/docs/source/_rst/weighting/linear_weighting.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
LinearWeighting
=============================
diff --git a/docs/source/_rst/weighting/no_weighting.rst b/docs/source/_rst/weighting/no_weighting.rst
index f6794eb5c..060910474 100644
--- a/docs/source/_rst/weighting/no_weighting.rst
+++ b/docs/source/_rst/weighting/no_weighting.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
No Weighting
===================
.. currentmodule:: pina.weighting.no_weighting
diff --git a/docs/source/_rst/weighting/ntk_weighting.rst b/docs/source/_rst/weighting/ntk_weighting.rst
index acee58fa2..4ef7d8ddc 100644
--- a/docs/source/_rst/weighting/ntk_weighting.rst
+++ b/docs/source/_rst/weighting/ntk_weighting.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
NeuralTangentKernelWeighting
=============================
.. currentmodule:: pina.weighting.ntk_weighting
diff --git a/docs/source/_rst/weighting/scalar_weighting.rst b/docs/source/_rst/weighting/scalar_weighting.rst
index 712425086..aad4b1398 100644
--- a/docs/source/_rst/weighting/scalar_weighting.rst
+++ b/docs/source/_rst/weighting/scalar_weighting.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
ScalarWeighting
===================
.. currentmodule:: pina.weighting.scalar_weighting
diff --git a/docs/source/_rst/weighting/self_adaptive_weighting.rst b/docs/source/_rst/weighting/self_adaptive_weighting.rst
index 32ed13aba..257fd0c61 100644
--- a/docs/source/_rst/weighting/self_adaptive_weighting.rst
+++ b/docs/source/_rst/weighting/self_adaptive_weighting.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
SelfAdaptiveWeighting
=============================
.. currentmodule:: pina.weighting.self_adaptive_weighting
diff --git a/docs/source/_rst/weighting/weighting_interface.rst b/docs/source/_rst/weighting/weighting_interface.rst
index 19cf34b42..3240459ab 100644
--- a/docs/source/_rst/weighting/weighting_interface.rst
+++ b/docs/source/_rst/weighting/weighting_interface.rst
@@ -1,3 +1,7 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
WeightingInterface
===================
.. currentmodule:: pina.weighting.weighting_interface
diff --git a/docs/source/_static/custom.css b/docs/source/_static/custom.css
new file mode 100644
index 000000000..822e9c325
--- /dev/null
+++ b/docs/source/_static/custom.css
@@ -0,0 +1,35 @@
+/* Hero section */
+.hero {
+ text-align: center;
+ padding: 3rem 0;
+}
+.hero img {
+ max-width: 320px;
+}
+.hero .tagline {
+ font-size: 1.25rem;
+ color: var(--pst-color-text-muted);
+ margin: 1rem 0 2rem;
+}
+
+/* Feature cards — subtle lift on hover */
+.sd-card {
+ transition: transform 0.2s ease, box-shadow 0.2s ease;
+}
+.sd-card:hover {
+ transform: translateY(-2px);
+ box-shadow: 0 4px 12px rgba(0,0,0,0.1);
+}
+
+/* Card links — no underline */
+.sd-card a {
+ text-decoration: none;
+}
+
+/* Hero buttons — always white text */
+.hero .btn {
+ color: #fff !important;
+}
+.hero .btn:hover {
+ color: #fff !important;
+}
diff --git a/docs/source/_team.rst b/docs/source/_team.rst
index 287f11fcc..68a9e90ee 100644
--- a/docs/source/_team.rst
+++ b/docs/source/_team.rst
@@ -1,28 +1,33 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
+
PINA Team
-==============
+==========
-**PINA** is currently developed in the `SISSA MathLab `_, in collaboration with `Fast Computing `_.
+**PINA** is part of the `PyTorch ecosystem `_ and currently developed at the `SISSA MathLab `_, in collaboration with `Fast Computing `_.
.. figure:: index_files/fast_mathlab.png
:align: center
:width: 500
-A significant part of **PINA** has been written either as a by-product for other projects people were funded for, or by people on university-funded positions.
-There are probably many of such projects that have led to some development of **PINA**. We are very grateful for this support!
-In particular, we acknowledge the following sources of support with great gratitude:
+A significant part of **PINA** has been written either as a by-product of funded projects or by people on university-funded positions. We are very grateful for this support. In particular, we acknowledge:
* `H2020 ERC CoG 2015 AROMA-CFD project 681447 `_, P.I. Professor `Prof. Gianluigi Rozza `_ at `SISSA MathLab `_.
-* `Next Generation EU `_ for ambiental and digital transition for Italy.
+* `Next Generation EU `_ for environmental and digital transition in Italy.
.. figure:: index_files/foudings.png
:align: center
:width: 500
-We also acknowledge the contribuition of `Maria Strazzullo `_ in the early developments of the package. A special
-thank goeas to all the students and researchers from different universities which contributed to the package.
-Finally we warmly thank all the
-`contributors `_ which are the real heart of **PINA**!
+We also acknowledge the contribution of `Maria Strazzullo `_ in the early development of the package. A special thank you goes to all the students and researchers from different universities who contributed to the package. Finally, we warmly thank all the `contributors `_ who are the real heart of **PINA**!
.. figure:: index_files/university_dev_pina.png
:align: center
:width: 500
+
+See Also
+--------
+
+* :doc:`Cite PINA <_cite>`
+* :doc:`Contributing <_contributing>`
diff --git a/docs/source/_tutorial.rst b/docs/source/_tutorial.rst
index 99958ffcd..b432909ea 100644
--- a/docs/source/_tutorial.rst
+++ b/docs/source/_tutorial.rst
@@ -1,9 +1,12 @@
-🚀 Welcome to the PINA Tutorials!
-==================================
+.. docmeta::
+ :last_reviewed: 2026-06-24
-In this folder we collect useful tutorials in order to understand the principles and the potential of **PINA**.
-Whether you're just getting started or looking to deepen your understanding, these resources are here to guide you.
+Welcome to the PINA Tutorials
+==============================
+
+This section collects step-by-step tutorials to help you understand the principles and potential of **PINA**.
+Whether you are just getting started or looking to deepen your understanding, these resources will guide you.
Getting started with PINA
-------------------------
@@ -22,7 +25,7 @@ Physics Informed Neural Networks
- `Introductory Tutorial: Physics Informed Neural Networks with PINA `_
- `Enhancing PINNs with Extra Features to solve the Poisson Problem `_
- `Applying Hard Constraints in PINNs to solve the Wave Problem `_
-- `Applying Periodic Boundary Conditions in PINNs to solve the Helmotz Problem `_
+- `Applying Periodic Boundary Conditions in PINNs to solve the Helmholtz Problem `_
- `Inverse Problem Solving with Physics-Informed Neural Network `_
- `Learning Multiscale PDEs Using Fourier Feature Networks `_
- `Learning Bifurcating PDE Solutions with Physics-Informed Deep Ensembles `_
@@ -38,9 +41,15 @@ Neural Operator Learning
Supervised Learning
-------------------
-- `Introductory Tutorial: Supervised Learning with PINA `_
+- `Introductory Tutorial: Supervised Learning with PINA `_
- `Chemical Properties Prediction with Graph Neural Networks `_
- `Reduced Order Model with Graph Neural Networks for Unstructured Domains `_
- `Data-driven System Identification with SINDy `_
- `Unstructured Convolutional Autoencoders with Continuous Convolution `_
-- `Reduced Order Modeling with POD-RBF and POD-NN Approaches for Fluid Dynamics `_
\ No newline at end of file
+- `Reduced Order Modeling with POD-RBF and POD-NN Approaches for Fluid Dynamics `_
+
+See Also
+--------
+
+* :doc:`Quickstart guide <_quickstart>`
+* :doc:`API Reference <_rst/_code>`
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 9cc6f7454..7f5f4f8c7 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -42,6 +42,8 @@
"sphinx.ext.mathjax",
"sphinx.ext.intersphinx",
"paramref_extension", # this extension is made to remove paramref links from lightining doc
+ "docmeta_extension", # register .. docmeta:: directive for doc state tracking
+ "readme_include", # pull examples and news from the project README at build time
"sphinx_copybutton",
"sphinx_design",
]
@@ -145,7 +147,7 @@
"show_prev_next": False,
"navbar_start": ["navbar-logo"],
"navbar_end": ["navbar-icon-links"],
- "header_links_before_dropdown": 8,
+ "header_links_before_dropdown": 5,
}
html_context = {
@@ -171,9 +173,13 @@
# Link to external html files
html_extra_path = ["tutorials"]
+html_static_path = ["_static"]
+html_css_files = ["custom.css"]
+
# Avoid side bar for html files
html_sidebars = {
"_tutorial": [],
+ "_quickstart": [],
"_team": [],
"_cite": [],
"_contributing": [],
diff --git a/docs/source/index.rst b/docs/source/index.rst
index e5e7f02b2..924a7fdbf 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -1,77 +1,191 @@
+.. docmeta::
+ :last_reviewed: 2026-06-24
+
:html_theme.sidebar_secondary.remove:
Welcome to PINA's documentation!
=======================================
-.. grid:: 6
- :gutter: 1
+.. raw:: html
+
+
+
+.. grid:: 1 1 1 3
+ :gutter: 2
+
+ .. grid-item-card:: 🧩 Modular Architecture
+ :padding: 3
+ :class-body: text-center
+
+ Designed with composable abstractions — plug, replace, or extend components freely.
+
+ .. grid-item-card:: 🚀 Scalable Performance
+ :padding: 3
+ :class-body: text-center
+
+ Native multi-device training with minimal overhead for large-scale problems.
+
+ .. grid-item-card:: ⚙️ Highly Flexible
+ :padding: 3
+ :class-body: text-center
+
+ Full automation or granular control — PINA adapts to your workflow.
+
+**PINA** is an open-source Python library designed to simplify and accelerate
+the development of Scientific Machine Learning (SciML) solutions.
+Built on top of `PyTorch `_, `PyTorch Lightning `_,
+and `PyTorch Geometric `_,
+PINA provides an intuitive framework for defining, experimenting with,
+and solving complex problems using Neural Networks,
+Physics-Informed Neural Networks (PINNs), Neural Operators, and more.
+
+.. tab-set::
+
+ .. tab-item:: Data Driven Learning
+
+ .. code-block:: python
+
+ import torch
+ from pina import Trainer
+ from pina.model import FeedForward
+ from pina.problem.zoo import SupervisedProblem
+ from pina.solver import SupervisedSingleModelSolver
+
+ input_tensor = torch.rand((10, 1))
+ target_tensor = input_tensor.pow(3)
+
+ # Step 1. Define problem
+ problem = SupervisedProblem(input_tensor, target_tensor)
+
+ # Step 2. Define model
+ model = FeedForward(input_dimensions=1, output_dimensions=1, layers=[64, 64])
+
+ # Step 3. Define solver
+ solver = SupervisedSingleModelSolver(problem, model, use_lt=False)
+
+ # Step 4. Train
+ trainer = Trainer(solver, max_epochs=1000, accelerator="gpu")
+ trainer.train()
+
+ .. tab-item:: Physics-Informed Learning
+
+ .. code-block:: python
+
+ from pina.operator import grad
+ from pina.model import FeedForward
+ from pina.equation import Equation
+ from pina import Trainer, Condition
+ from pina.domain import CartesianDomain
+ from pina.problem import SpatialProblem
+ from pina.equation.zoo import FixedValue
+ from pina.solver import PhysicsInformedSingleModelSolver
+
+ def ode_equation(input_, output_):
+ u_x = grad(output_, input_, components=["u"], d=["x"])
+ u = output_.extract(["u"])
+ return u_x - u
+
+ class SimpleODE(SpatialProblem):
+ output_variables = ["u"]
+ spatial_domain = CartesianDomain({"x": [0, 1]})
+ domains = {
+ "x0": CartesianDomain({"x": 0.0}),
+ "D": CartesianDomain({"x": [0, 1]}),
+ }
+ conditions = {
+ "bound_cond": Condition(domain="x0", equation=FixedValue(1.0)),
+ "phys_cond": Condition(domain="D", equation=Equation(ode_equation)),
+ }
- .. grid-item::
+ # Step 1. Define problem
+ problem = SimpleODE()
+ problem.discretise_domain(n=100, mode="grid", domains=["D", "x0"])
- .. image:: index_files/tutorial_13_3.png
- :target: tutorial2/tutorial.html
+ # Step 2. Define model
+ model = FeedForward(input_dimensions=1, output_dimensions=1, layers=[64, 64])
- .. grid-item::
+ # Step 3. Define solver
+ solver = PhysicsInformedSingleModelSolver(problem, model)
- .. image:: index_files/tutorial_32_0.png
- :target: tutorial4/tutorial.html
+ # Step 4. Train
+ trainer = Trainer(solver, max_epochs=1000, accelerator="gpu")
+ trainer.train()
- .. grid-item::
+.. admonition:: What's New
+ :class: tip
- .. image:: index_files/tutorial_13_01.png
- :target: tutorial9/tutorial.html
+ .. readme-news::
- .. grid-item::
+.. grid:: 1 2 2 3
+ :gutter: 3
- .. image:: index_files/tutorial_36_0.png
- :target: tutorial6/tutorial.html
+ .. grid-item-card:: 📖 Installation
+ :link: _installation.html
+ :class-card: sd-shadow-sm
- .. grid-item::
+ Install PINA via pip, from source, or with extras.
- .. image:: index_files/tutorial_15_0.png
- :target: tutorial13/tutorial.html
+ .. grid-item-card:: 🚀 Quickstart
+ :link: _quickstart.html
+ :class-card: sd-shadow-sm
- .. grid-item::
+ Get up and running in 5 minutes.
- .. image:: index_files/tutorial_5_0.png
- :target: tutorial10/tutorial.html
+ .. grid-item-card:: 📚 API Reference
+ :link: _rst/_code.html
+ :class-card: sd-shadow-sm
-.. grid:: 1 1 3 3
+ Complete API docs for problems, solvers, models, and more.
- .. grid-item::
- :columns: 12 12 8 8
+ .. grid-item-card:: 🎓 Tutorials
+ :link: _tutorial.html
+ :class-card: sd-shadow-sm
- **PINA** is an open-source Python library designed to simplify and accelerate
- the development of Scientific Machine Learning (SciML) solutions.
- Built on top of `PyTorch `_, `PyTorch Lightning `_,
- and `PyTorch Geometric `_,
- PINA provides an intuitive framework for defining, experimenting with,
- and solving complex problems using Neural Networks,
- Physics-Informed Neural Networks (PINNs), Neural Operators, and more.
+ Step-by-step tutorials covering PINNs, Neural Operators, and more.
- - **Modular Architecture**: Designed with modularity in mind and relying on powerful yet composable abstractions, PINA allows users to easily plug, replace, or extend components, making experimentation and customization straightforward.
+ .. grid-item-card:: 📄 Cite PINA
+ :link: _cite.html
+ :class-card: sd-shadow-sm
- - **Scalable Performance**: With native support for multi-device training, PINA handles large datasets efficiently, offering performance close to hand-crafted implementations with minimal overhead.
+ Citation and BibTeX for academic use.
- - **Highly Flexible**: Whether you're looking for full automation or granular control, PINA adapts to your workflow. High-level abstractions simplify model definition, while expert users can dive deep to fine-tune every aspect of the training and inference process.
+ .. grid-item-card:: 🤝 Contributing
+ :link: _contributing.html
+ :class-card: sd-shadow-sm
- For further information or questions about **PINA** contact us by email.
-
- .. grid-item-card:: Contents
- :class-title: sd-fs-5
- :class-body: sd-pl-4
+ Guide for contributors, bug reports, and PRs.
- .. toctree::
- :maxdepth: 1
+ .. grid-item-card:: 👥 Team
+ :link: _team.html
+ :class-card: sd-shadow-sm
- Installing <_installation>
- API <_rst/_code>
- Tutorials <_tutorial>
- Cite PINA <_cite.rst>
- Contributing <_contributing>
- Team & Foundings <_team.rst>
- License <_LICENSE.rst>
+ Meet the PINA team and our funding sources.
+ .. grid-item-card:: 📜 License
+ :link: _LICENSE.html
+ :class-card: sd-shadow-sm
+ Open-source license information.
+.. toctree::
+ :hidden:
+ :maxdepth: 1
+ Quickstart <_quickstart>
+ API <_rst/_code>
+ Tutorials <_tutorial>
+ Contributing <_contributing>
+ Team & Foundings <_team.rst>
+ Installing <_installation>
+ Cite PINA <_cite.rst>
+ License <_LICENSE.rst>
diff --git a/docs/sphinx_extensions/docmeta_extension.py b/docs/sphinx_extensions/docmeta_extension.py
new file mode 100644
index 000000000..b76a54be7
--- /dev/null
+++ b/docs/sphinx_extensions/docmeta_extension.py
@@ -0,0 +1,20 @@
+from docutils.parsers.rst import directives
+from docutils.parsers.rst import Directive
+
+
+class DocMetaDirective(Directive):
+ has_content = False
+ option_spec = {
+ "status": directives.unchanged,
+ "needs_example": directives.unchanged,
+ "needs_advanced_example": directives.unchanged,
+ "reviewer": directives.unchanged,
+ "last_reviewed": directives.unchanged,
+ }
+
+ def run(self):
+ return []
+
+
+def setup(app):
+ app.add_directive("docmeta", DocMetaDirective)
diff --git a/docs/sphinx_extensions/readme_include.py b/docs/sphinx_extensions/readme_include.py
new file mode 100644
index 000000000..f3a65e9a7
--- /dev/null
+++ b/docs/sphinx_extensions/readme_include.py
@@ -0,0 +1,144 @@
+import re
+from dataclasses import dataclass, field
+from pathlib import Path
+from typing import List
+
+from docutils import nodes
+from docutils.parsers.rst import Directive
+from docutils.statemachine import StringList
+from sphinx.application import Sphinx
+
+README_PATH = Path(__file__).resolve().parents[2] / "README.md"
+
+
+# ----------------------------
+# Regex
+# ----------------------------
+
+UL_PATTERN = re.compile(r"", re.DOTALL | re.IGNORECASE)
+LI_PATTERN = re.compile(r"]*>(.*?)", re.DOTALL | re.IGNORECASE)
+
+LINK_PATTERN = re.compile(
+ r']*>(.*?)',
+ re.DOTALL | re.IGNORECASE,
+)
+
+BR_PATTERN = re.compile(r"
", re.IGNORECASE)
+TAG_PATTERN = re.compile(r"?\w+[^>]*>")
+
+
+# ----------------------------
+# IO
+# ----------------------------
+
+
+def _read_readme() -> str:
+ if not README_PATH.exists():
+ return ""
+ return README_PATH.read_text(encoding="utf-8")
+
+
+def _extract_section(text: str, header: str) -> str:
+ m = re.search(
+ rf"\s*{re.escape(header)}\s*
(.*?)(?=|\Z)",
+ text,
+ re.DOTALL | re.IGNORECASE,
+ )
+ return m.group(1).strip() if m else ""
+
+
+# ----------------------------
+# SINGLE SAFE CONVERTER
+# ----------------------------
+
+
+def _html_to_rst(text: str) -> str:
+ """
+ Convert HTML fragment → RST safely (ONE PASS ONLY).
+ """
+
+ text = BR_PATTERN.sub("\n", text)
+
+ # links — process first so inner tags are stripped before global conversion
+ def _link_replace(m):
+ url = m.group(1)
+ label = TAG_PATTERN.sub("", m.group(2)).strip()
+ return f"`{label} <{url}>`_"
+
+ text = LINK_PATTERN.sub(_link_replace, text)
+
+ # bold
+ text = re.sub(
+ r"<(?:b|strong)>(.*?)(?:b|strong)>",
+ r"**\1**",
+ text,
+ flags=re.I | re.S,
+ )
+
+ # italic
+ text = re.sub(
+ r"<(?:i|em)>(.*?)(?:i|em)>",
+ r"*\1*",
+ text,
+ flags=re.I | re.S,
+ )
+
+ # remove remaining HTML
+ text = TAG_PATTERN.sub("", text)
+
+ # normalize whitespace
+ return re.sub(r"\s+", " ", text).strip()
+
+
+# ----------------------------
+# EXTRACTION (NO DOUBLE PROCESSING)
+# ----------------------------
+
+
+def _extract_news(text: str) -> List[str]:
+ section = _extract_section(text, "News & Announcements")
+ if not section:
+ return []
+
+ items = []
+
+ ul = UL_PATTERN.search(section)
+ if ul:
+ for li in LI_PATTERN.findall(ul.group(1)):
+ items.append(_html_to_rst(li))
+
+ return items
+
+
+def _build_rst(items: List[str]) -> List[str]:
+ return [f"- {x}" for x in items]
+
+
+# ----------------------------
+# SPHINX
+# ----------------------------
+
+
+class ReadmeNews(Directive):
+ has_content = False
+
+ def run(self):
+ readme = _read_readme()
+ news = _extract_news(readme)
+ rst_lines = _build_rst(news)
+
+ container = nodes.container()
+
+ if rst_lines:
+ self.state.nested_parse(StringList(rst_lines), 0, container)
+
+ return container.children
+
+
+def setup(app: Sphinx):
+ app.add_directive("readme-news", ReadmeNews)
+ return {
+ "version": "1.0",
+ "parallel_read_safe": True,
+ "parallel_write_safe": True,
+ }
diff --git a/pina/__init__.py b/pina/__init__.py
index cafab2d31..19e849310 100644
--- a/pina/__init__.py
+++ b/pina/__init__.py
@@ -1,7 +1,15 @@
"""
A specialized framework for Scientific Machine Learning (SciML), providing
tools for Physics-Informed Neural Networks (PINNs), Neural Operators,
-and data-driven physical modeling.
+and data-driven physical modelling.
+
+:Example:
+
+ >>> from pina import LabelTensor
+ >>> import torch
+ >>> t = LabelTensor(torch.rand(3, 2), ['x', 'y'])
+ >>> t.labels
+ ['x', 'y']
"""
__all__ = [
diff --git a/pina/_src/adaptive_function/adaptive_celu.py b/pina/_src/adaptive_function/adaptive_celu.py
index bb460933c..3822cab23 100644
--- a/pina/_src/adaptive_function/adaptive_celu.py
+++ b/pina/_src/adaptive_function/adaptive_celu.py
@@ -45,6 +45,16 @@ class AdaptiveCELU(BaseAdaptiveFunction):
physics-informed neural networks*.
Journal of Computational Physics, 404.
DOI: `JCP 10.1016 `_.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.adaptive_function import AdaptiveCELU
+ >>> act = AdaptiveCELU()
+ >>> x = torch.randn(10, 3)
+ >>> out = act(x)
+ >>> out.shape
+ torch.Size([10, 3])
"""
def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
diff --git a/pina/_src/adaptive_function/adaptive_elu.py b/pina/_src/adaptive_function/adaptive_elu.py
index 12b40fa46..2ba9151ce 100644
--- a/pina/_src/adaptive_function/adaptive_elu.py
+++ b/pina/_src/adaptive_function/adaptive_elu.py
@@ -48,6 +48,16 @@ class AdaptiveELU(BaseAdaptiveFunction):
physics-informed neural networks*.
Journal of Computational Physics, 404.
DOI: `JCP 10.1016 `_.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.adaptive_function import AdaptiveELU
+ >>> act = AdaptiveELU()
+ >>> x = torch.randn(10, 3)
+ >>> out = act(x)
+ >>> out.shape
+ torch.Size([10, 3])
"""
def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
diff --git a/pina/_src/adaptive_function/adaptive_exp.py b/pina/_src/adaptive_function/adaptive_exp.py
index c6484f8c9..16db53ab5 100644
--- a/pina/_src/adaptive_function/adaptive_exp.py
+++ b/pina/_src/adaptive_function/adaptive_exp.py
@@ -41,6 +41,16 @@ class AdaptiveExp(BaseAdaptiveFunction):
physics-informed neural networks*.
Journal of Computational Physics, 404.
DOI: `JCP 10.1016 `_.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.adaptive_function import AdaptiveExp
+ >>> act = AdaptiveExp()
+ >>> x = torch.randn(10, 3)
+ >>> out = act(x)
+ >>> out.shape
+ torch.Size([10, 3])
"""
def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
diff --git a/pina/_src/adaptive_function/adaptive_function_interface.py b/pina/_src/adaptive_function/adaptive_function_interface.py
index d53694bcd..e11f1ccd9 100644
--- a/pina/_src/adaptive_function/adaptive_function_interface.py
+++ b/pina/_src/adaptive_function/adaptive_function_interface.py
@@ -6,6 +6,16 @@
class AdaptiveFunctionInterface(metaclass=ABCMeta):
"""
Abstract interface for all adaptive functions.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.adaptive_function import AdaptiveTanh
+ >>> act = AdaptiveTanh()
+ >>> x = torch.randn(10, 3)
+ >>> out = act(x)
+ >>> out.shape
+ torch.Size([10, 3])
"""
@abstractmethod
diff --git a/pina/_src/adaptive_function/adaptive_gelu.py b/pina/_src/adaptive_function/adaptive_gelu.py
index 148d43d52..6209312e3 100644
--- a/pina/_src/adaptive_function/adaptive_gelu.py
+++ b/pina/_src/adaptive_function/adaptive_gelu.py
@@ -46,6 +46,16 @@ class AdaptiveGELU(BaseAdaptiveFunction):
physics-informed neural networks*.
Journal of Computational Physics, 404.
DOI: `JCP 10.1016 `_.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.adaptive_function import AdaptiveGELU
+ >>> act = AdaptiveGELU()
+ >>> x = torch.randn(10, 3)
+ >>> out = act(x)
+ >>> out.shape
+ torch.Size([10, 3])
"""
def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
diff --git a/pina/_src/adaptive_function/adaptive_mish.py b/pina/_src/adaptive_function/adaptive_mish.py
index 1c7278a1e..989625f79 100644
--- a/pina/_src/adaptive_function/adaptive_mish.py
+++ b/pina/_src/adaptive_function/adaptive_mish.py
@@ -45,6 +45,16 @@ class AdaptiveMish(BaseAdaptiveFunction):
physics-informed neural networks*.
Journal of Computational Physics, 404.
DOI: `JCP 10.1016 `_.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.adaptive_function import AdaptiveMish
+ >>> act = AdaptiveMish()
+ >>> x = torch.randn(10, 3)
+ >>> out = act(x)
+ >>> out.shape
+ torch.Size([10, 3])
"""
def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
diff --git a/pina/_src/adaptive_function/adaptive_relu.py b/pina/_src/adaptive_function/adaptive_relu.py
index bd8ec0879..cce91fd0a 100644
--- a/pina/_src/adaptive_function/adaptive_relu.py
+++ b/pina/_src/adaptive_function/adaptive_relu.py
@@ -46,6 +46,16 @@ class AdaptiveReLU(BaseAdaptiveFunction):
physics-informed neural networks*.
Journal of Computational Physics, 404.
DOI: `JCP 10.1016 `_.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.adaptive_function import AdaptiveReLU
+ >>> act = AdaptiveReLU()
+ >>> x = torch.randn(10, 3)
+ >>> out = act(x)
+ >>> out.shape
+ torch.Size([10, 3])
"""
def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
diff --git a/pina/_src/adaptive_function/adaptive_sigmoid.py b/pina/_src/adaptive_function/adaptive_sigmoid.py
index c88eafab2..c43fa6e24 100644
--- a/pina/_src/adaptive_function/adaptive_sigmoid.py
+++ b/pina/_src/adaptive_function/adaptive_sigmoid.py
@@ -47,6 +47,16 @@ class AdaptiveSigmoid(BaseAdaptiveFunction):
physics-informed neural networks*.
Journal of Computational Physics, 404.
DOI: `JCP 10.1016 `_.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.adaptive_function import AdaptiveSigmoid
+ >>> act = AdaptiveSigmoid()
+ >>> x = torch.randn(10, 3)
+ >>> out = act(x)
+ >>> out.shape
+ torch.Size([10, 3])
"""
def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
diff --git a/pina/_src/adaptive_function/adaptive_silu.py b/pina/_src/adaptive_function/adaptive_silu.py
index d35b867a6..7b29cfdde 100644
--- a/pina/_src/adaptive_function/adaptive_silu.py
+++ b/pina/_src/adaptive_function/adaptive_silu.py
@@ -47,6 +47,16 @@ class AdaptiveSiLU(BaseAdaptiveFunction):
physics-informed neural networks*.
Journal of Computational Physics, 404.
DOI: `JCP 10.1016 `_.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.adaptive_function import AdaptiveSiLU
+ >>> act = AdaptiveSiLU()
+ >>> x = torch.randn(10, 3)
+ >>> out = act(x)
+ >>> out.shape
+ torch.Size([10, 3])
"""
def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
diff --git a/pina/_src/adaptive_function/adaptive_siren.py b/pina/_src/adaptive_function/adaptive_siren.py
index dfb42b4b9..d83129945 100644
--- a/pina/_src/adaptive_function/adaptive_siren.py
+++ b/pina/_src/adaptive_function/adaptive_siren.py
@@ -40,6 +40,16 @@ class AdaptiveSIREN(BaseAdaptiveFunction):
physics-informed neural networks*.
Journal of Computational Physics, 404.
DOI: `JCP 10.1016 `_.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.adaptive_function import AdaptiveSIREN
+ >>> act = AdaptiveSIREN()
+ >>> x = torch.randn(10, 3)
+ >>> out = act(x)
+ >>> out.shape
+ torch.Size([10, 3])
"""
def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
diff --git a/pina/_src/adaptive_function/adaptive_softmax.py b/pina/_src/adaptive_function/adaptive_softmax.py
index 7f2ad156f..5cebe94c6 100644
--- a/pina/_src/adaptive_function/adaptive_softmax.py
+++ b/pina/_src/adaptive_function/adaptive_softmax.py
@@ -47,6 +47,16 @@ class AdaptiveSoftmax(BaseAdaptiveFunction):
physics-informed neural networks*.
Journal of Computational Physics, 404.
DOI: `JCP 10.1016 `_.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.adaptive_function import AdaptiveSoftmax
+ >>> act = AdaptiveSoftmax()
+ >>> x = torch.randn(10, 3)
+ >>> out = act(x)
+ >>> out.shape
+ torch.Size([10, 3])
"""
def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
diff --git a/pina/_src/adaptive_function/adaptive_softmin.py b/pina/_src/adaptive_function/adaptive_softmin.py
index b07e27bbf..dde020c35 100644
--- a/pina/_src/adaptive_function/adaptive_softmin.py
+++ b/pina/_src/adaptive_function/adaptive_softmin.py
@@ -47,6 +47,16 @@ class AdaptiveSoftmin(BaseAdaptiveFunction):
physics-informed neural networks*.
Journal of Computational Physics, 404.
DOI: `JCP 10.1016 `_.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.adaptive_function import AdaptiveSoftmin
+ >>> act = AdaptiveSoftmin()
+ >>> x = torch.randn(10, 3)
+ >>> out = act(x)
+ >>> out.shape
+ torch.Size([10, 3])
"""
def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
diff --git a/pina/_src/adaptive_function/adaptive_tanh.py b/pina/_src/adaptive_function/adaptive_tanh.py
index 513f4b3f0..6333252f3 100644
--- a/pina/_src/adaptive_function/adaptive_tanh.py
+++ b/pina/_src/adaptive_function/adaptive_tanh.py
@@ -40,6 +40,16 @@ class AdaptiveTanh(BaseAdaptiveFunction):
physics-informed neural networks*.
Journal of Computational Physics, 404.
DOI: `JCP 10.1016 `_.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.adaptive_function import AdaptiveTanh
+ >>> act = AdaptiveTanh()
+ >>> x = torch.randn(10, 3)
+ >>> out = act(x)
+ >>> out.shape
+ torch.Size([10, 3])
"""
def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
diff --git a/pina/_src/adaptive_function/base_adaptive_function.py b/pina/_src/adaptive_function/base_adaptive_function.py
index c391d308a..356e6ce5c 100644
--- a/pina/_src/adaptive_function/base_adaptive_function.py
+++ b/pina/_src/adaptive_function/base_adaptive_function.py
@@ -47,6 +47,16 @@ class BaseAdaptiveFunction(torch.nn.Module, AdaptiveFunctionInterface):
physics-informed neural networks*.
Journal of Computational Physics, 404.
DOI: `JCP 10.1016 `_.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.adaptive_function import AdaptiveTanh
+ >>> act = AdaptiveTanh(alpha=1.0, beta=1.0, gamma=0.0)
+ >>> x = torch.randn(10, 3)
+ >>> out = act(x)
+ >>> out.shape
+ torch.Size([10, 3])
"""
def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
diff --git a/pina/_src/callback/optim/switch_optimizer.py b/pina/_src/callback/optim/switch_optimizer.py
index 36561fa28..af9aaaf7b 100644
--- a/pina/_src/callback/optim/switch_optimizer.py
+++ b/pina/_src/callback/optim/switch_optimizer.py
@@ -17,6 +17,15 @@ class SwitchOptimizer(Callback):
At the target epoch, the provided optimizers are hooked to the model
parameters and replace the current optimizers in both the PINA solver and
the Lightning trainer strategy.
+
+ :Example:
+
+ >>> from pina.optim import TorchOptimizer
+ >>> import torch
+ >>> optimizer = TorchOptimizer(torch.optim.Adam, lr=0.01)
+ >>> switch = SwitchOptimizer(new_optimizers=optimizer, epoch_switch=10)
+ >>> switch._epoch_switch
+ 10
"""
def __init__(self, new_optimizers, epoch_switch):
diff --git a/pina/_src/callback/optim/switch_scheduler.py b/pina/_src/callback/optim/switch_scheduler.py
index 61284fb50..05eade337 100644
--- a/pina/_src/callback/optim/switch_scheduler.py
+++ b/pina/_src/callback/optim/switch_scheduler.py
@@ -12,6 +12,16 @@ class SwitchScheduler(Callback):
This callback enables switching to new scheduler(s) at a specified epoch
without interrupting the training loop. It is useful for staged training
strategies where different learning rate policies are applied sequentially.
+
+ :Example:
+
+ >>> from pina.optim import TorchScheduler
+ >>> import torch
+ >>> scheduler = TorchScheduler(
+ ... torch.optim.lr_scheduler.StepLR, step_size=5)
+ >>> switch = SwitchScheduler(new_schedulers=scheduler, epoch_switch=10)
+ >>> switch._epoch_switch
+ 10
"""
def __init__(self, new_schedulers, epoch_switch):
diff --git a/pina/_src/callback/processing/metric_tracker.py b/pina/_src/callback/processing/metric_tracker.py
index 360a5aacb..df3295569 100644
--- a/pina/_src/callback/processing/metric_tracker.py
+++ b/pina/_src/callback/processing/metric_tracker.py
@@ -9,6 +9,12 @@
class MetricTracker(Callback):
"""
Callback for collecting selected metrics logged during training.
+
+ :Example:
+
+ >>> tracker = MetricTracker(metrics=["train_loss"])
+ >>> tracker.metrics_to_track
+ ['train_loss']
"""
def __init__(self, metrics_to_track=None):
diff --git a/pina/_src/callback/processing/pina_progress_bar.py b/pina/_src/callback/processing/pina_progress_bar.py
index bde274052..5ffbe77da 100644
--- a/pina/_src/callback/processing/pina_progress_bar.py
+++ b/pina/_src/callback/processing/pina_progress_bar.py
@@ -18,6 +18,12 @@ class PINAProgressBar(TQDMProgressBar):
names assigned to the problem conditions, or to global losses. Global losses
are selected using ``"train"``, ``"val"``, or ``"test"``, and are internally
expanded to the corresponding logged loss metrics.
+
+ :Example:
+
+ >>> progress_bar = PINAProgressBar(metrics="val")
+ >>> progress_bar._sorted_metrics
+ ['val']
"""
GLOBAL_LOSS_KEYS = ("train", "val", "test")
@@ -67,7 +73,7 @@ def get_metrics(self, trainer, __):
:rtype: dict
.. note::
- This method overrides the default Lightning behavior. It can be
+ This method overrides the default Lightning behaviour. It can be
further customized by subclassing.
"""
# Retrieve standard metrics and user-selected progress bar metrics
diff --git a/pina/_src/callback/refinement/base_refinement.py b/pina/_src/callback/refinement/base_refinement.py
index 640528975..f24180f35 100644
--- a/pina/_src/callback/refinement/base_refinement.py
+++ b/pina/_src/callback/refinement/base_refinement.py
@@ -16,12 +16,18 @@ class BaseRefinement(Callback, RefinementInterface):
A refinement strategy is responsible for dynamically updating the training
dataset during optimization, typically by resampling points in the domain
- based on model behavior (e.g., error-driven refinement).
+ based on model behaviour (e.g., error-driven refinement).
All specific refinement strategies should inherit from this class and
implement its abstract methods.
This class is not meant to be instantiated directly.
+
+ :Example:
+
+ >>> refinement = BaseRefinement(sample_every=100)
+ >>> refinement.sample_every
+ 100
"""
def __init__(self, sample_every, condition_to_update=None):
diff --git a/pina/_src/callback/refinement/refinement_interface.py b/pina/_src/callback/refinement/refinement_interface.py
index 320d526af..731a8dcd6 100644
--- a/pina/_src/callback/refinement/refinement_interface.py
+++ b/pina/_src/callback/refinement/refinement_interface.py
@@ -6,6 +6,20 @@
class RefinementInterface(metaclass=ABCMeta):
"""
Abstract interface for all refinement strategies.
+
+ :Example:
+
+ >>> class MyRefinement(RefinementInterface):
+ ... def on_train_start(self, trainer, solver): pass
+ ... def on_train_epoch_end(self, trainer, solver): pass
+ ... def sample(self, pts, name, solver): return pts
+ ... @property
+ ... def dataset(self): return {}
+ ... @property
+ ... def initial_population_size(self): return {}
+ >>> ref = MyRefinement()
+ >>> ref.initial_population_size
+ {}
"""
@abstractmethod
diff --git a/pina/_src/condition/condition.py b/pina/_src/condition/condition.py
index 69875a6a8..9bbb25860 100644
--- a/pina/_src/condition/condition.py
+++ b/pina/_src/condition/condition.py
@@ -20,12 +20,12 @@ class Condition:
It encapsulates all types of constraints - physical, boundary, initial, or
data-driven - that the solver must satisfy during training. The specific
- behavior is inferred from the arguments passed to the constructor.
+ behaviour is inferred from the arguments passed to the constructor.
Multiple types of conditions can be used within the same problem, allowing
for a high degree of flexibility in defining complex problems.
- The :class:`Condition` class behavior specializes internally based on the
+ The :class:`Condition` class behaviour specializes internally based on the
arguments provided during instantiation. Depending on the specified keyword
arguments, the class automatically selects the appropriate internal
implementation.
diff --git a/pina/_src/core/graph.py b/pina/_src/core/graph.py
index 4b0a2fcb0..4b9679ed5 100644
--- a/pina/_src/core/graph.py
+++ b/pina/_src/core/graph.py
@@ -12,6 +12,17 @@ class Graph(Data):
"""
Extends :class:`~torch_geometric.data.Data` class to include additional
checks and functionalities.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.graph import Graph
+ >>> pos = torch.randn(5, 2)
+ >>> edge_index = torch.tensor([[0, 1, 2, 3, 4],
+ ... [1, 2, 3, 4, 0]])
+ >>> graph = Graph(pos=pos, edge_index=edge_index, x=pos)
+ >>> graph.num_nodes
+ 5
"""
def __new__(
@@ -201,6 +212,17 @@ def extract(self, labels, attr="x"):
class GraphBuilder:
"""
A class that allows an easy definition of :class:`Graph` instances.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.graph import GraphBuilder
+ >>> pos = torch.randn(5, 2)
+ >>> edge_index = torch.tensor([[0, 1, 2, 3, 4],
+ ... [1, 2, 3, 4, 0]])
+ >>> graph = GraphBuilder(pos=pos, edge_index=edge_index, loop=True)
+ >>> isinstance(graph, Graph)
+ True
"""
def __new__(
@@ -294,6 +316,15 @@ class RadiusGraph(GraphBuilder):
Extends the :class:`~pina.graph.GraphBuilder` class to compute
``edge_index`` based on a radius. Each point is connected to all the points
within the radius.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.graph import RadiusGraph
+ >>> pos = torch.randn(5, 2)
+ >>> graph = RadiusGraph(pos=pos, radius=0.5)
+ >>> isinstance(graph, Graph)
+ True
"""
def __new__(cls, pos, radius, **kwargs):
@@ -340,6 +371,15 @@ class KNNGraph(GraphBuilder):
"""
Extends the :class:`~pina.graph.GraphBuilder` class to compute
``edge_index`` based on a K-nearest neighbors algorithm.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.graph import KNNGraph
+ >>> pos = torch.randn(10, 2)
+ >>> graph = KNNGraph(pos=pos, neighbours=3)
+ >>> isinstance(graph, Graph)
+ True
"""
def __new__(cls, pos, neighbours, **kwargs):
@@ -388,6 +428,16 @@ class LabelBatch(Batch):
"""
Extends the :class:`~torch_geometric.data.Batch` class to include
:class:`~pina.label_tensor.LabelTensor` objects.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.graph import Graph, LabelBatch
+ >>> graphs = [Graph(pos=torch.randn(3, 2),
+ ... edge_index=torch.tensor([[0, 1], [1, 0]])) for _ in range(2)]
+ >>> batch = LabelBatch.from_data_list(graphs)
+ >>> batch.num_graphs
+ 2
"""
@classmethod
diff --git a/pina/_src/core/label_tensor.py b/pina/_src/core/label_tensor.py
index 41bccc6fc..d97ef077d 100644
--- a/pina/_src/core/label_tensor.py
+++ b/pina/_src/core/label_tensor.py
@@ -84,7 +84,7 @@ def __init__(self, x, labels):
def full_labels(self):
"""
Returns the full labels of the tensor, even for the dimensions that are
- not labeled.
+ not labelled.
:return: The full labels of the tensor
:rtype: dict
@@ -240,6 +240,14 @@ def extract(self, labels_to_extract):
"""
def get_label_indices(dim_labels, labels_te):
+ """Get the indices of the specified labels in the dimension labels.
+
+ :param list dim_labels: The list of dimension labels.
+ :param labels_te: The label(s) to find indices for.
+ :type labels_te: str | list[str]
+ :return: The indices or slice for the label(s).
+ :rtype: list[int] | slice
+ """
if isinstance(labels_te, (int, str)):
labels_te = [labels_te]
return (
@@ -621,6 +629,12 @@ def sort_labels(self, dim=None):
"""
def arg_sort(lst):
+ """Return the indices that would sort the list.
+
+ :param list lst: The list to sort.
+ :return: The indices that sort the list.
+ :rtype: list[int]
+ """
return sorted(range(len(lst)), key=lambda x: lst[x])
if dim is None:
diff --git a/pina/_src/core/operator.py b/pina/_src/core/operator.py
index 8ed28c3a6..f67afdbad 100644
--- a/pina/_src/core/operator.py
+++ b/pina/_src/core/operator.py
@@ -338,6 +338,15 @@ def grad(output_, input_, components=None, d=None):
:raises RuntimeError: If component labels are missing from the ``output_``.
:return: The computed gradient tensor.
:rtype: LabelTensor
+
+ :Example:
+
+ >>> from pina import LabelTensor
+ >>> import torch
+ >>> x = LabelTensor(torch.rand(5, 1), labels=["x"])
+ >>> u = LabelTensor(x ** 2, labels=["u"])
+ >>> grad(u, x, components=["u"], d=["x"])
+ LabelTensor([[2.0 * x] ...], labels=["dudx"])
"""
components, d = _check_values(
output_=output_, input_=input_, components=components, d=d
@@ -369,6 +378,16 @@ def div(output_, input_, components=None, d=None):
:raises ValueError: If the length of ``components`` and ``d`` do not match.
:return: The computed divergence tensor.
:rtype: LabelTensor
+
+ :Example:
+
+ >>> from pina import LabelTensor
+ >>> import torch
+ >>> x = LabelTensor(torch.rand(5, 2), labels=["x", "y"])
+ >>> u = LabelTensor(torch.cat([x.extract("x")**2,
+ ... x.extract("y")**2], dim=-1), labels=["u", "v"])
+ >>> div(u, x, components=["u", "v"], d=["x", "y"])
+ LabelTensor([...], labels=["div"])
"""
components, d = _check_values(
output_=output_, input_=input_, components=components, d=d
@@ -411,6 +430,15 @@ def laplacian(output_, input_, components=None, d=None, method="std"):
:raises ValueError: If the passed method is neither ``std`` nor ``divgrad``.
:return: The computed laplacian tensor.
:rtype: LabelTensor
+
+ :Example:
+
+ >>> from pina import LabelTensor
+ >>> import torch
+ >>> x = LabelTensor(torch.rand(5, 1), labels=["x"])
+ >>> u = LabelTensor(x ** 3, labels=["u"])
+ >>> laplacian(u, x, components=["u"], d=["x"])
+ LabelTensor([...], labels=["ddu"])
"""
components, d = _check_values(
output_=output_, input_=input_, components=components, d=d
@@ -454,6 +482,17 @@ def advection(output_, input_, velocity_field, components=None, d=None):
match that of the input tensor.
:return: The computed advection tensor.
:rtype: LabelTensor
+
+ :Example:
+
+ >>> from pina import LabelTensor
+ >>> import torch
+ >>> x = LabelTensor(torch.rand(5, 2), labels=["x", "y"])
+ >>> u = LabelTensor(torch.cat([x.extract("x")**2,
+ ... torch.zeros(5, 2)], dim=-1), labels=["u", "v", "w", "z"])
+ >>> advection(u, x, velocity_field=["v", "w"],
+ ... components=["u"], d=["x", "y"])
+ LabelTensor([...], labels=["adv_u"])
"""
components, d = _check_values(
output_=output_, input_=input_, components=components, d=d
diff --git a/pina/_src/core/trainer.py b/pina/_src/core/trainer.py
index 0b89ab168..e2c766034 100644
--- a/pina/_src/core/trainer.py
+++ b/pina/_src/core/trainer.py
@@ -24,6 +24,16 @@ class Trainer(lightning.pytorch.Trainer):
The trainer configures solver execution, dataset splitting, batching,
logging, device placement for unknown parameters, and gradient tracking
requirements for physics-informed solvers.
+
+ :Example:
+
+ >>> from pina.solver import BaseSolver
+ >>> from pina.problem import BaseProblem
+ >>> import torch
+ >>> # Trainer is typically used with a solver and problem:
+ >>> # trainer = Trainer(solver=solver_instance, batch_size=32,
+ >>> # max_epochs=100)
+ >>> # trainer.train()
"""
# Available batching modes
diff --git a/pina/_src/core/utils.py b/pina/_src/core/utils.py
index d0226ea83..74cd1a57f 100644
--- a/pina/_src/core/utils.py
+++ b/pina/_src/core/utils.py
@@ -42,6 +42,13 @@ class or, if ``subclass=True``, whether it is a subclass of the specified
of ``object_instance`` instead of an instance. Default is ``False``.
:raises ValueError: If ``object_`` does not inherit from ``object_instance``
as expected.
+
+ :Example:
+
+ >>> from pina import LabelTensor
+ >>> import torch
+ >>> tensor = LabelTensor(torch.randn(3, 2), labels=["x", "y"])
+ >>> check_consistency(tensor, LabelTensor)
"""
if not isinstance(object_, (list, set, tuple)):
object_ = [object_]
@@ -135,6 +142,16 @@ def merge_tensors(tensors):
:raises ValueError: If the list of tensors is empty.
:return: The merged tensor.
:rtype: LabelTensor
+
+ :Example:
+
+ >>> from pina import LabelTensor
+ >>> import torch
+ >>> t1 = LabelTensor(torch.tensor([[1.0], [2.0]]), labels=["x"])
+ >>> t2 = LabelTensor(torch.tensor([[3.0], [4.0]]), labels=["y"])
+ >>> merged = merge_tensors([t1, t2])
+ >>> merged.labels
+ ['x', 'y']
"""
if tensors:
return reduce(merge_two_tensors, tensors[1:], tensors[0])
@@ -172,6 +189,12 @@ def torch_lhs(n, dim):
:raises ValueError: If `dim` is less than 1.
:return: The sampled points.
:rtype: torch.tensor
+
+ :Example:
+
+ >>> samples = torch_lhs(10, 2)
+ >>> samples.shape
+ torch.Size([10, 2])
"""
if not isinstance(n, int):
@@ -216,6 +239,12 @@ def chebyshev_roots(n):
:param int n: The number of roots to return.
:return: The roots of the Chebyshev polynomials.
:rtype: torch.Tensor
+
+ :Example:
+
+ >>> roots = chebyshev_roots(5)
+ >>> roots.shape
+ torch.Size([5])
"""
pi = torch.acos(torch.zeros(1)).item() * 2
k = torch.arange(n)
@@ -254,6 +283,13 @@ def in_range(value, range_vals, strict=True):
Default is True.
:return: True if the value satisfies the range condition, False otherwise.
:rtype: bool
+
+ :Example:
+
+ >>> in_range(5, [0, 10])
+ True
+ >>> in_range(10, [0, 10], strict=False)
+ True
"""
# Validate inputs
check_consistency(value, (float, int))
diff --git a/pina/_src/data/aggregator.py b/pina/_src/data/aggregator.py
index d6e149a3f..52c33ce3a 100644
--- a/pina/_src/data/aggregator.py
+++ b/pina/_src/data/aggregator.py
@@ -8,6 +8,21 @@ class _Aggregator:
The aggregator combines batches produced by multiple dataloaders according
to the selected batching strategy. It is primarily used to coordinate the
iteration of multiple training conditions within a single training loop.
+
+ :Example:
+
+ >>> import torch
+ >>> from torch.utils.data import DataLoader, TensorDataset
+ >>> ds1 = TensorDataset(torch.randn(10, 2))
+ >>> ds2 = TensorDataset(torch.randn(15, 2))
+ >>> dl1 = DataLoader(ds1, batch_size=5)
+ >>> dl2 = DataLoader(ds2, batch_size=5)
+ >>> aggregator = _Aggregator(
+ ... {"cond1": dl1, "cond2": dl2},
+ ... batching_mode="common_batch_size"
+ ... )
+ >>> len(aggregator)
+ 3
"""
def __init__(self, dataloaders, batching_mode):
diff --git a/pina/_src/data/condition_subset.py b/pina/_src/data/condition_subset.py
index 068e833a2..563b3647a 100644
--- a/pina/_src/data/condition_subset.py
+++ b/pina/_src/data/condition_subset.py
@@ -10,6 +10,17 @@ class _ConditionSubset:
The class behaves similarly to :class:`torch.utils.data.Subset` and supports
cyclic indexing together with optional automatic batching.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.condition import Condition
+ >>> from pina import LabelTensor
+ >>> pts = LabelTensor(torch.randn(20, 2), labels=["x", "y"])
+ >>> condition = Condition(input=pts)
+ >>> subset = _ConditionSubset(condition, [0, 1, 2, 3, 4], True)
+ >>> len(subset)
+ 5
"""
def __init__(self, condition, indices, automatic_batching):
diff --git a/pina/_src/data/creator.py b/pina/_src/data/creator.py
index 4a5e3207b..f3f7784cc 100644
--- a/pina/_src/data/creator.py
+++ b/pina/_src/data/creator.py
@@ -9,7 +9,26 @@ class _Creator:
Utility class for creating data loaders associated with multiple conditions.
The class supports different batching strategies to adapt data loading
- behavior to specific training requirements
+ behaviour to specific training requirements
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.condition import Condition
+ >>> from pina import LabelTensor
+ >>> from pina._src.data.condition_subset import _ConditionSubset
+ >>> pts = LabelTensor(torch.randn(20, 2), labels=["x", "y"])
+ >>> condition = Condition(input=pts)
+ >>> creator = _Creator(
+ ... batching_mode="common_batch_size", batch_size=5,
+ ... shuffle=False, automatic_batching=True,
+ ... num_workers=0, pin_memory=False,
+ ... conditions={"cond1": condition}
+ ... )
+ >>> datasets = {"cond1": _ConditionSubset(condition, list(range(20)), True)}
+ >>> dataloaders = creator(datasets)
+ >>> list(dataloaders.keys())
+ ['cond1']
"""
def __init__(
diff --git a/pina/_src/data/data_module.py b/pina/_src/data/data_module.py
index c5d3804a5..73b13a626 100644
--- a/pina/_src/data/data_module.py
+++ b/pina/_src/data/data_module.py
@@ -26,6 +26,26 @@ class DataModule(LightningDataModule):
resulting subsets are wrapped into :class:`_ConditionSubset` objects.
Dataloaders are then created and aggregated according to the selected
batching strategy.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina import LabelTensor
+ >>> from pina.condition import Condition
+ >>> from pina.problem import BaseProblem
+ >>> class MyProblem(BaseProblem):
+ ... def __init__(self):
+ ... super().__init__()
+ ... pts = LabelTensor(torch.randn(100, 2), labels=["x", "y"])
+ ... self.conditions = {"cond1": Condition(input=pts)}
+ >>> problem = MyProblem()
+ >>> dm = DataModule(problem, train_size=0.8, val_size=0.1,
+ ... test_size=0.1, batch_size=32, batching_mode="common_batch_size",
+ ... automatic_batching=False, shuffle=True, num_workers=0,
+ ... pin_memory=False)
+ >>> dm.setup("fit")
+ >>> list(dm.train_datasets.keys())
+ ['cond1']
"""
def __init__(
diff --git a/pina/_src/data/manager/batch_manager.py b/pina/_src/data/manager/batch_manager.py
index cdea44616..eeec71071 100644
--- a/pina/_src/data/manager/batch_manager.py
+++ b/pina/_src/data/manager/batch_manager.py
@@ -5,6 +5,16 @@ class _BatchManager(dict):
"""
Dict-like container for batched data with attribute-style access and
convenience methods for device placement.
+
+ :Example:
+
+ >>> import torch
+ >>> batch = _BatchManager({"x": torch.tensor([1, 2, 3]),
+ ... "y": torch.tensor([4, 5, 6])})
+ >>> batch.x
+ tensor([1, 2, 3])
+ >>> batch.to("cpu")
+ _BatchManager({'x': tensor([1, 2, 3]), 'y': tensor([4, 5, 6])})
"""
def to(self, device):
diff --git a/pina/_src/data/manager/data_manager.py b/pina/_src/data/manager/data_manager.py
index 3fd976d1d..7734aed08 100644
--- a/pina/_src/data/manager/data_manager.py
+++ b/pina/_src/data/manager/data_manager.py
@@ -15,6 +15,16 @@ class _DataManager:
:class:`~pina.data.manager.tensor_data_manager._TensorDataManager` or
:class:`~pina.data.manager.graph_data_manager._GraphDataManager` depending
on the types of the provided keyword arguments.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina import LabelTensor
+ >>> input_tensor = LabelTensor(torch.randn(10, 2), labels=["x", "y"])
+ >>> target_tensor = torch.randn(10, 1)
+ >>> manager = _DataManager(input=input_tensor, target=target_tensor)
+ >>> type(manager).__name__
+ '_TensorDataManager'
"""
def __new__(cls, **kwargs):
diff --git a/pina/_src/data/manager/data_manager_interface.py b/pina/_src/data/manager/data_manager_interface.py
index 41b841e39..bb8c5ef36 100644
--- a/pina/_src/data/manager/data_manager_interface.py
+++ b/pina/_src/data/manager/data_manager_interface.py
@@ -6,6 +6,20 @@
class _DataManagerInterface(metaclass=ABCMeta):
"""
Abstract interface for all data managers.
+
+ :Example:
+
+ >>> import torch
+ >>> class CustomManager(_DataManagerInterface):
+ ... def __init__(self, data): self.data = data
+ ... def __len__(self): return len(self.data)
+ ... def __getitem__(self, idx): return self.data[idx]
+ ... def to_batch(self): return self
+ ... @staticmethod
+ ... def create_batch(items): return items
+ >>> manager = CustomManager([1, 2, 3])
+ >>> len(manager)
+ 3
"""
@abstractmethod
diff --git a/pina/_src/data/manager/graph_data_manager.py b/pina/_src/data/manager/graph_data_manager.py
index 660c75f83..59ca970a7 100644
--- a/pina/_src/data/manager/graph_data_manager.py
+++ b/pina/_src/data/manager/graph_data_manager.py
@@ -13,6 +13,16 @@ class _GraphDataManager(_DataManagerInterface):
"""
Data manager for graph-based data. It handles inputs stored as
:class:`Graph`, :class:`Data`, or lists / tuples of these types.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.graph import Graph
+ >>> graph = Graph(pos=torch.randn(5, 2),
+ ... edge_index=torch.tensor([[0, 1], [1, 0]]))
+ >>> manager = _GraphDataManager(data=graph, target=torch.randn(5, 1))
+ >>> len(manager)
+ 1
"""
def __init__(self, **kwargs):
diff --git a/pina/_src/data/manager/tensor_data_manager.py b/pina/_src/data/manager/tensor_data_manager.py
index 2e530c40f..3ff817b1b 100644
--- a/pina/_src/data/manager/tensor_data_manager.py
+++ b/pina/_src/data/manager/tensor_data_manager.py
@@ -10,6 +10,17 @@ class _TensorDataManager(_DataManagerInterface):
"""
Data manager for tensor-based data. It handles inputs stored as
:class:`torch.Tensor` or :class:`~pina.label_tensor.LabelTensor`.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina import LabelTensor
+ >>> manager = _TensorDataManager(
+ ... input=LabelTensor(torch.randn(10, 2), labels=["x", "y"]),
+ ... target=torch.randn(10, 1)
+ ... )
+ >>> len(manager)
+ 10
"""
def __init__(self, **kwargs):
diff --git a/pina/_src/domain/base_domain.py b/pina/_src/domain/base_domain.py
index d3cea3848..6b385a7ef 100644
--- a/pina/_src/domain/base_domain.py
+++ b/pina/_src/domain/base_domain.py
@@ -14,6 +14,15 @@ class BaseDomain(DomainInterface, metaclass=ABCMeta):
abstract methods of :class:`~pina.domain.domain_interface.DomainInterface`.
This class is not meant to be instantiated directly.
+
+ :Example:
+
+ >>> from pina.domain import CartesianDomain
+ >>> domain = CartesianDomain({"x": [0, 1], "y": [0, 1]})
+ >>> domain.variables
+ ['x', 'y']
+ >>> domain.sample(5, mode="random")
+ LabelTensor([...], labels=["x", "y"])
"""
def __init__(self, variables_dict=None):
diff --git a/pina/_src/domain/base_operation.py b/pina/_src/domain/base_operation.py
index ff83e1551..610b48bb5 100644
--- a/pina/_src/domain/base_operation.py
+++ b/pina/_src/domain/base_operation.py
@@ -18,6 +18,15 @@ class BaseOperation(OperationInterface, BaseDomain, metaclass=ABCMeta):
:class:`~pina.domain.domain_interface.DomainInterface`.
This class is not meant to be instantiated directly.
+
+ :Example:
+
+ >>> from pina.domain import CartesianDomain, Union
+ >>> d1 = CartesianDomain({"x": [0, 1], "y": [0, 1]})
+ >>> d2 = CartesianDomain({"x": [1, 2], "y": [0, 1]})
+ >>> union = Union([d1, d2])
+ >>> isinstance(union, BaseOperation)
+ True
"""
def __init__(self, geometries):
diff --git a/pina/_src/domain/domain_interface.py b/pina/_src/domain/domain_interface.py
index f9b980bd8..1d9d0c438 100644
--- a/pina/_src/domain/domain_interface.py
+++ b/pina/_src/domain/domain_interface.py
@@ -6,6 +6,13 @@
class DomainInterface(metaclass=ABCMeta):
"""
Abstract interface for all geometric domains.
+
+ :Example:
+
+ >>> from pina.domain import CartesianDomain
+ >>> domain = CartesianDomain({"x": [0, 1]})
+ >>> isinstance(domain, DomainInterface)
+ True
"""
@abstractmethod
diff --git a/pina/_src/domain/ellipsoid_domain.py b/pina/_src/domain/ellipsoid_domain.py
index 402ec29a8..92213e0b3 100644
--- a/pina/_src/domain/ellipsoid_domain.py
+++ b/pina/_src/domain/ellipsoid_domain.py
@@ -51,7 +51,7 @@ def __init__(self, ellipsoid_dict, sample_surface=False):
def compute_center_axes(self):
"""
- Compute centers and axes for the ellipsoid.
+ Compute centres and axes for the ellipsoid.
"""
if self._range:
rng_vars = sorted(self._range.keys())
diff --git a/pina/_src/domain/operation_interface.py b/pina/_src/domain/operation_interface.py
index 357556105..6076a6964 100644
--- a/pina/_src/domain/operation_interface.py
+++ b/pina/_src/domain/operation_interface.py
@@ -7,6 +7,15 @@
class OperationInterface(DomainInterface, metaclass=ABCMeta):
"""
Abstract interface for all set operations defined on geometric domains.
+
+ :Example:
+
+ >>> from pina.domain import Union, CartesianDomain
+ >>> d1 = CartesianDomain({"x": [0, 1]})
+ >>> d2 = CartesianDomain({"x": [2, 3]})
+ >>> union = Union([d1, d2])
+ >>> isinstance(union, OperationInterface)
+ True
"""
@property
diff --git a/pina/_src/equation/base_equation.py b/pina/_src/equation/base_equation.py
index 4fff8dd3b..13bf75052 100644
--- a/pina/_src/equation/base_equation.py
+++ b/pina/_src/equation/base_equation.py
@@ -17,6 +17,13 @@ class BaseEquation(metaclass=ABCMeta):
abstract methods.
This class is not meant to be instantiated directly.
+
+ :Example:
+
+ >>> # This class is not meant to be instantiated directly.
+ >>> # Use specific equation implementations instead:
+ >>> from pina.equation import PoissonEquation
+ >>> eq = PoissonEquation(forcing_term=lambda x: x**2)
"""
@abstractmethod
diff --git a/pina/_src/equation/equation.py b/pina/_src/equation/equation.py
index d10da2bbe..e516b801e 100644
--- a/pina/_src/equation/equation.py
+++ b/pina/_src/equation/equation.py
@@ -11,6 +11,13 @@ class Equation(BaseEquation):
It can be passed to a :class:`~pina.condition.condition.Condition` object to
define the conditions under which the model is trained.
+
+ :Example:
+
+ >>> from pina.equation import Equation
+ >>> eq = Equation(lambda x, u: u - x)
+ >>> # Use within a Condition:
+ >>> # condition = Condition(domain=domain, equation=eq)
"""
def __init__(self, equation):
diff --git a/pina/_src/equation/equation_interface.py b/pina/_src/equation/equation_interface.py
index fa59de678..b497a3347 100644
--- a/pina/_src/equation/equation_interface.py
+++ b/pina/_src/equation/equation_interface.py
@@ -6,6 +6,13 @@
class EquationInterface(metaclass=ABCMeta):
"""
Abstract interface for all equations.
+
+ :Example:
+
+ >>> # This class is not meant to be instantiated directly.
+ >>> # Use specific equation implementations instead:
+ >>> from pina.equation import PoissonEquation
+ >>> eq = PoissonEquation(forcing_term=lambda x: x**2)
"""
@abstractmethod
diff --git a/pina/_src/equation/zoo/acoustic_wave_equation.py b/pina/_src/equation/zoo/acoustic_wave_equation.py
index 8a6d2bf07..6d725d1f5 100644
--- a/pina/_src/equation/zoo/acoustic_wave_equation.py
+++ b/pina/_src/equation/zoo/acoustic_wave_equation.py
@@ -22,6 +22,13 @@ class AcousticWaveEquation(Equation):
Here, :math:`c` is the wave propagation speed, and :math:`\Box` is the
d'Alembert operator.
+
+ :Example:
+
+ >>> from pina.equation import AcousticWaveEquation
+ >>> eq = AcousticWaveEquation(c=1.0)
+ >>> # Use within a Condition:
+ >>> # condition = Condition(domain=domain, equation=eq)
"""
def __init__(self, c):
diff --git a/pina/_src/equation/zoo/advection_equation.py b/pina/_src/equation/zoo/advection_equation.py
index 81e476bd5..98ef7e034 100644
--- a/pina/_src/equation/zoo/advection_equation.py
+++ b/pina/_src/equation/zoo/advection_equation.py
@@ -16,6 +16,13 @@ class AdvectionEquation(Equation):
\frac{\partial u}{\partial t} + c \cdot \nabla u = 0
Here, :math:`c` is the advection velocity parameter.
+
+ :Example:
+
+ >>> from pina.equation import AdvectionEquation
+ >>> eq = AdvectionEquation(c=1.0)
+ >>> # Use within a Condition:
+ >>> # condition = Condition(domain=domain, equation=eq)
"""
def __init__(self, c):
diff --git a/pina/_src/equation/zoo/allen_cahn_equation.py b/pina/_src/equation/zoo/allen_cahn_equation.py
index e7091add2..3804b4c88 100644
--- a/pina/_src/equation/zoo/allen_cahn_equation.py
+++ b/pina/_src/equation/zoo/allen_cahn_equation.py
@@ -14,6 +14,13 @@ class AllenCahnEquation(Equation):
\frac{\partial u}{\partial t} - \alpha \Delta u + \beta(u^3 - u) = 0
Here, :math:`\alpha` and :math:`\beta` are parameters of the equation.
+
+ :Example:
+
+ >>> from pina.equation import AllenCahnEquation
+ >>> eq = AllenCahnEquation(alpha=1.0, beta=1.0)
+ >>> # Use within a Condition:
+ >>> # condition = Condition(domain=domain, equation=eq)
"""
def __init__(self, alpha, beta):
diff --git a/pina/_src/equation/zoo/burgers_equation.py b/pina/_src/equation/zoo/burgers_equation.py
index 07c8eed22..b50c65ab8 100644
--- a/pina/_src/equation/zoo/burgers_equation.py
+++ b/pina/_src/equation/zoo/burgers_equation.py
@@ -15,6 +15,13 @@ class BurgersEquation(Equation):
\frac{\partial u}{\partial t} + u \cdot \nabla u = \nu \Delta u
Here, :math:`\nu` is the viscosity coefficient.
+
+ :Example:
+
+ >>> from pina.equation import BurgersEquation
+ >>> eq = BurgersEquation(nu=0.01)
+ >>> # Use within a Condition:
+ >>> # condition = Condition(domain=domain, equation=eq)
"""
def __init__(self, nu):
diff --git a/pina/_src/equation/zoo/diffusion_reaction_equation.py b/pina/_src/equation/zoo/diffusion_reaction_equation.py
index 4f276dd54..e9e2331f4 100644
--- a/pina/_src/equation/zoo/diffusion_reaction_equation.py
+++ b/pina/_src/equation/zoo/diffusion_reaction_equation.py
@@ -17,6 +17,13 @@ class DiffusionReactionEquation(Equation):
Here, :math:`\alpha` is a parameter of the equation, while :math:`f` is the
reaction term.
+
+ :Example:
+
+ >>> from pina.equation import DiffusionReactionEquation
+ >>> eq = DiffusionReactionEquation(alpha=1.0, forcing_term=lambda x: x**2)
+ >>> # Use within a Condition:
+ >>> # condition = Condition(domain=domain, equation=eq)
"""
def __init__(self, alpha, forcing_term):
diff --git a/pina/_src/equation/zoo/fixed_flux.py b/pina/_src/equation/zoo/fixed_flux.py
index 858f3bdd1..d1ced96fe 100644
--- a/pina/_src/equation/zoo/fixed_flux.py
+++ b/pina/_src/equation/zoo/fixed_flux.py
@@ -8,6 +8,13 @@
class FixedFlux(Equation):
"""
Equation to enforce a fixed flux, or divergence, for a specific condition.
+
+ :Example:
+
+ >>> from pina.equation import FixedFlux
+ >>> eq = FixedFlux(value=0.0)
+ >>> # Use within a Condition:
+ >>> # condition = Condition(domain=domain, equation=eq)
"""
def __init__(self, value, components=None, d=None):
diff --git a/pina/_src/equation/zoo/fixed_gradient.py b/pina/_src/equation/zoo/fixed_gradient.py
index 2c60c007f..a7d9311b9 100644
--- a/pina/_src/equation/zoo/fixed_gradient.py
+++ b/pina/_src/equation/zoo/fixed_gradient.py
@@ -8,6 +8,13 @@
class FixedGradient(Equation):
"""
Equation to enforce a fixed gradient for a specific condition.
+
+ :Example:
+
+ >>> from pina.equation import FixedGradient
+ >>> eq = FixedGradient(value=0.0)
+ >>> # Use within a Condition:
+ >>> # condition = Condition(domain=domain, equation=eq)
"""
def __init__(self, value, components=None, d=None):
diff --git a/pina/_src/equation/zoo/fixed_laplacian.py b/pina/_src/equation/zoo/fixed_laplacian.py
index 8d0fa7cf4..5234735a5 100644
--- a/pina/_src/equation/zoo/fixed_laplacian.py
+++ b/pina/_src/equation/zoo/fixed_laplacian.py
@@ -9,6 +9,13 @@
class FixedLaplacian(Equation):
"""
Equation to enforce a fixed laplacian for a specific condition.
+
+ :Example:
+
+ >>> from pina.equation import FixedLaplacian
+ >>> eq = FixedLaplacian(value=0.0)
+ >>> # Use within a Condition:
+ >>> # condition = Condition(domain=domain, equation=eq)
"""
def __init__(self, value, components=None, d=None):
@@ -59,6 +66,13 @@ def equation(input_, output_):
# Back-compatibility with version 0.2, to be removed soon
class Laplace(FixedLaplacian):
+ """
+ Deprecated wrapper for :class:`FixedLaplacian` with ``value=0.0``.
+
+ .. deprecated:: 0.3
+ Use :class:`FixedLaplacian` with ``value=0.0`` instead.
+ """
+
def __init__(self, components=None, d=None):
warnings.warn(
"Laplace is deprecated, use FixedLaplacian with value=0.0 instead.",
diff --git a/pina/_src/equation/zoo/fixed_value.py b/pina/_src/equation/zoo/fixed_value.py
index 25c81c8b8..00ebdf6a9 100644
--- a/pina/_src/equation/zoo/fixed_value.py
+++ b/pina/_src/equation/zoo/fixed_value.py
@@ -8,6 +8,13 @@ class FixedValue(Equation):
"""
Equation to enforce a fixed value. Can be used to enforce Dirichlet Boundary
conditions.
+
+ :Example:
+
+ >>> from pina.equation import FixedValue
+ >>> eq = FixedValue(value=0.0)
+ >>> # Use within a Condition:
+ >>> # condition = Condition(domain=domain, equation=eq)
"""
def __init__(self, value, components=None):
diff --git a/pina/_src/equation/zoo/helmholtz_equation.py b/pina/_src/equation/zoo/helmholtz_equation.py
index 57b353bf0..ffe02cfe9 100644
--- a/pina/_src/equation/zoo/helmholtz_equation.py
+++ b/pina/_src/equation/zoo/helmholtz_equation.py
@@ -16,6 +16,13 @@ class HelmholtzEquation(Equation):
Here, :math:`k` is the squared wavenumber, while :math:`f` is the
forcing term.
+
+ :Example:
+
+ >>> from pina.equation import HelmholtzEquation
+ >>> eq = HelmholtzEquation(k=1.0, forcing_term=lambda x: x**2)
+ >>> # Use within a Condition:
+ >>> # condition = Condition(domain=domain, equation=eq)
"""
def __init__(self, k, forcing_term):
diff --git a/pina/_src/equation/zoo/poisson_equation.py b/pina/_src/equation/zoo/poisson_equation.py
index 2ab80ff33..06710c817 100644
--- a/pina/_src/equation/zoo/poisson_equation.py
+++ b/pina/_src/equation/zoo/poisson_equation.py
@@ -15,6 +15,13 @@ class PoissonEquation(Equation):
\Delta u - f = 0
Here, :math:`f` is the forcing term.
+
+ :Example:
+
+ >>> from pina.equation import PoissonEquation
+ >>> eq = PoissonEquation(forcing_term=lambda x: x**2)
+ >>> # Use within a Condition:
+ >>> # condition = Condition(domain=domain, equation=eq)
"""
def __init__(self, forcing_term):
diff --git a/pina/_src/loss/base_dual_loss.py b/pina/_src/loss/base_dual_loss.py
index 9287142bc..81cfbf52d 100644
--- a/pina/_src/loss/base_dual_loss.py
+++ b/pina/_src/loss/base_dual_loss.py
@@ -13,6 +13,16 @@ class BaseDualLoss(DualLossInterface):
abstract methods.
This class is not meant to be instantiated directly.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.loss import PowerLoss
+ >>> loss = PowerLoss(p=2, reduction="mean")
+ >>> input = torch.randn(10, 3)
+ >>> target = torch.randn(10, 3)
+ >>> loss(input, target)
+ tensor(...)
"""
# Define available reduction methods
diff --git a/pina/_src/loss/dual_loss_interface.py b/pina/_src/loss/dual_loss_interface.py
index 6db6bc44f..b2a7ad851 100644
--- a/pina/_src/loss/dual_loss_interface.py
+++ b/pina/_src/loss/dual_loss_interface.py
@@ -8,6 +8,16 @@ class DualLossInterface(_Loss, metaclass=ABCMeta):
"""
Abstract interface for all losses requiring both an input and a target
tensor.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.loss import LpLoss
+ >>> loss = LpLoss(p=2)
+ >>> input = torch.randn(10, 3)
+ >>> target = torch.randn(10, 3)
+ >>> loss(input, target)
+ tensor(...)
"""
@abstractmethod
diff --git a/pina/_src/loss/lp_loss.py b/pina/_src/loss/lp_loss.py
index c2d25ea4e..ab88773ce 100644
--- a/pina/_src/loss/lp_loss.py
+++ b/pina/_src/loss/lp_loss.py
@@ -35,6 +35,16 @@ class LpLoss(BaseDualLoss):
\end{cases}
where :math:`N` is the batch size.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.loss import LpLoss
+ >>> loss = LpLoss(p=2, reduction="mean")
+ >>> input = torch.randn(10, 3)
+ >>> target = torch.randn(10, 3)
+ >>> loss(input, target)
+ tensor(...)
"""
def __init__(self, p=2, reduction="mean", relative=False):
diff --git a/pina/_src/loss/power_loss.py b/pina/_src/loss/power_loss.py
index b8a0821bb..8922a1f27 100644
--- a/pina/_src/loss/power_loss.py
+++ b/pina/_src/loss/power_loss.py
@@ -36,6 +36,16 @@ class PowerLoss(BaseDualLoss):
\end{cases}
where :math:`N` is the batch size.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.loss import PowerLoss
+ >>> loss = PowerLoss(p=2, reduction="mean")
+ >>> input = torch.randn(10, 3)
+ >>> target = torch.randn(10, 3)
+ >>> loss(input, target)
+ tensor(...)
"""
def __init__(self, p=2, reduction="mean", relative=False):
diff --git a/pina/_src/loss/sinkhorn_loss.py b/pina/_src/loss/sinkhorn_loss.py
index 9feddc458..8c215acd6 100644
--- a/pina/_src/loss/sinkhorn_loss.py
+++ b/pina/_src/loss/sinkhorn_loss.py
@@ -64,6 +64,16 @@ class SinkhornLoss(BaseDualLoss):
In Proceedings of the 35th Conference on Uncertainty in Artificial
Intelligence.
URL: ``_.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.loss import SinkhornLoss
+ >>> loss = SinkhornLoss(p=2, eps=0.1, iterations=50)
+ >>> input = torch.randn(10, 3)
+ >>> target = torch.randn(10, 3)
+ >>> loss(input, target)
+ tensor(...)
"""
def __init__(self, p=2, eps=0.1, iterations=100):
diff --git a/pina/_src/model/average_neural_operator.py b/pina/_src/model/average_neural_operator.py
index e16e3430f..c2a063528 100644
--- a/pina/_src/model/average_neural_operator.py
+++ b/pina/_src/model/average_neural_operator.py
@@ -22,6 +22,19 @@ class AveragingNeuralOperator(KernelNeuralOperator):
*The Nonlocal Neural Operator: Universal Approximation*.
DOI: `arXiv preprint arXiv:2304.13221.
`_
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model import AveragingNeuralOperator, FeedForward
+ >>> lifting_net = FeedForward(input_dimensions=4, output_dimensions=20)
+ >>> projecting_net = FeedForward(input_dimensions=22, output_dimensions=1)
+ >>> model = AveragingNeuralOperator(
+ ... lifting_net, projecting_net,
+ ... field_indices=["f"], coordinates_indices=["x", "y", "z"]
+ ... )
+ >>> x = torch.randn(10, 5, 4)
+ >>> out = model(x)
"""
def __init__(
diff --git a/pina/_src/model/block/average_neural_operator_block.py b/pina/_src/model/block/average_neural_operator_block.py
index 4b5af8081..899728353 100644
--- a/pina/_src/model/block/average_neural_operator_block.py
+++ b/pina/_src/model/block/average_neural_operator_block.py
@@ -32,6 +32,14 @@ class AVNOBlock(nn.Module):
*The Nonlocal Neural Operator: Universal Approximation*.
DOI: `arXiv preprint arXiv:2304.13221.
`_
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import AVNOBlock
+ >>> block = AVNOBlock(hidden_size=20)
+ >>> x = torch.randn(10, 5, 20)
+ >>> out = block(x)
"""
def __init__(self, hidden_size=100, func=nn.GELU):
diff --git a/pina/_src/model/block/convolution.py b/pina/_src/model/block/convolution.py
index bfe7054af..15fc6dcf2 100644
--- a/pina/_src/model/block/convolution.py
+++ b/pina/_src/model/block/convolution.py
@@ -33,6 +33,24 @@ class BaseContinuousConv(torch.nn.Module, metaclass=ABCMeta):
:math:`[B \times N_{out} \times N \times D]`, where :math:`B` is the
batch_size, :math:`N_{out}` is the number of output fields, :math:`N`
the number of points in the mesh, :math:`D` the dimension of the problem.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import BaseContinuousConv
+ >>> from pina.model.block.convolution import BaseContinuousConv
+ >>> class MyConv(BaseContinuousConv):
+ ... def forward(self, X): return X
+ ... def transpose_overlap(self, X): return X
+ ... def transpose_no_overlap(self, X): return X
+ ... def _initialize_convolution(self, X, type_): pass
+ >>> stride = {
+ ... "domain": [10, 10],
+ ... "start": [0, 0],
+ ... "jump": [3, 3],
+ ... "direction": [1, 1],
+ ... }
+ >>> conv = MyConv(1, 2, [3, 3], stride)
"""
def __init__(
@@ -118,6 +136,14 @@ def __init__(
class DefaultKernel(torch.nn.Module):
"""
The default kernel.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block.convolution import BaseContinuousConv
+ >>> kernel = BaseContinuousConv.DefaultKernel(input_dim=2, output_dim=4)
+ >>> x = torch.randn(10, 2)
+ >>> out = kernel(x)
"""
def __init__(self, input_dim, output_dim):
diff --git a/pina/_src/model/block/convolution_2d.py b/pina/_src/model/block/convolution_2d.py
index 935bb0afa..b347590f5 100644
--- a/pina/_src/model/block/convolution_2d.py
+++ b/pina/_src/model/block/convolution_2d.py
@@ -31,6 +31,28 @@ class ContinuousConvBlock(BaseContinuousConv):
*A continuous convolutional trainable filter for modelling unstructured
data*. Comput Mech 72, 253-265 (2023).
DOI ``_
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import ContinuousConvBlock
+ >>> class MLP(torch.nn.Module):
+ ... def __init__(self):
+ ... super().__init__()
+ ... self.model = torch.nn.Sequential(
+ ... torch.nn.Linear(2, 8), torch.nn.ReLU(),
+ ... torch.nn.Linear(8, 8), torch.nn.ReLU(),
+ ... torch.nn.Linear(8, 1)
+ ... )
+ ... def forward(self, x):
+ ... return self.model(x)
+ >>> stride = {
+ ... "domain": [10, 10],
+ ... "start": [0, 0],
+ ... "jumps": [3, 3],
+ ... "direction": [1, 1],
+ ... }
+ >>> conv = ContinuousConvBlock(1, 2, [3, 3], stride, MLP)
"""
def __init__(
diff --git a/pina/_src/model/block/embedding.py b/pina/_src/model/block/embedding.py
index f9f05c119..e28466dfb 100644
--- a/pina/_src/model/block/embedding.py
+++ b/pina/_src/model/block/embedding.py
@@ -51,6 +51,16 @@ class PeriodicBoundaryEmbedding(torch.nn.Module):
the derivatives up to the order :math:`\sim 2,3`. This is not guaranteed
for orders :math:`>3`. The PINA module is tested only for periodic
boundary conditions on the function itself.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import PeriodicBoundaryEmbedding
+ >>> emb = PeriodicBoundaryEmbedding(
+ ... input_dimension=2, periods={"x": 1.0, "y": 2.0}
+ ... )
+ >>> x = torch.randn(10, 2)
+ >>> out = emb(x)
"""
def __init__(self, input_dimension, periods, output_dimension=None):
@@ -212,6 +222,16 @@ class FourierFeatureEmbedding(torch.nn.Module):
113938.
DOI: `10.1016/j.cma.2021.113938.
`_
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import FourierFeatureEmbedding
+ >>> emb = FourierFeatureEmbedding(
+ ... input_dimension=2, output_dimension=16, sigma=2.0
+ ... )
+ >>> x = torch.randn(10, 2)
+ >>> out = emb(x)
"""
def __init__(self, input_dimension, output_dimension, sigma):
diff --git a/pina/_src/model/block/fourier_block.py b/pina/_src/model/block/fourier_block.py
index 2510320ec..990fafb17 100644
--- a/pina/_src/model/block/fourier_block.py
+++ b/pina/_src/model/block/fourier_block.py
@@ -18,7 +18,7 @@ class FourierBlock1D(nn.Module):
The module computes the spectral convolution of the input with a linear
kernel in the fourier space, and then it maps the input back to the physical
- space. The output is then added to a Linear tranformation of the input in
+ space. The output is then added to a Linear transformation of the input in
the physical space. Finally an activation function is applied to the output.
.. seealso::
@@ -29,6 +29,15 @@ class FourierBlock1D(nn.Module):
DOI: `arXiv preprint arXiv:2010.08895.
`_
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import FourierBlock1D
+ >>> block = FourierBlock1D(
+ ... input_numb_fields=2, output_numb_fields=2, n_modes=16
+ ... )
+ >>> x = torch.randn(10, 2, 50)
+ >>> out = block(x)
"""
def __init__(
@@ -83,7 +92,7 @@ class FourierBlock2D(nn.Module):
The module computes the spectral convolution of the input with a linear
kernel in the fourier space, and then it maps the input back to the physical
- space. The output is then added to a Linear tranformation of the input in
+ space. The output is then added to a Linear transformation of the input in
the physical space. Finally an activation function is applied to the output.
.. seealso::
@@ -93,6 +102,16 @@ class FourierBlock2D(nn.Module):
*Fourier neural operator for parametric partial differential equations*.
DOI: `arXiv preprint arXiv:2010.08895.
`_
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import FourierBlock2D
+ >>> block = FourierBlock2D(
+ ... input_numb_fields=2, output_numb_fields=2, n_modes=[8, 8]
+ ... )
+ >>> x = torch.randn(10, 2, 50, 50)
+ >>> out = block(x)
"""
def __init__(
@@ -147,7 +166,7 @@ class FourierBlock3D(nn.Module):
The module computes the spectral convolution of the input with a linear
kernel in the fourier space, and then it maps the input back to the physical
- space. The output is then added to a Linear tranformation of the input in
+ space. The output is then added to a Linear transformation of the input in
the physical space. Finally an activation function is applied to the output.
.. seealso::
@@ -157,6 +176,16 @@ class FourierBlock3D(nn.Module):
*Fourier neural operator for parametric partial differential equations*.
DOI: `arXiv preprint arXiv:2010.08895.
`_
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import FourierBlock3D
+ >>> block = FourierBlock3D(
+ ... input_numb_fields=2, output_numb_fields=2, n_modes=[4, 4, 4]
+ ... )
+ >>> x = torch.randn(10, 2, 20, 20, 20)
+ >>> out = block(x)
"""
def __init__(
diff --git a/pina/_src/model/block/gno_block.py b/pina/_src/model/block/gno_block.py
index 600803463..bb1deb9b0 100644
--- a/pina/_src/model/block/gno_block.py
+++ b/pina/_src/model/block/gno_block.py
@@ -7,6 +7,16 @@
class GNOBlock(MessagePassing):
"""
The inner block of the Graph Neural Operator, based on Message Passing.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import GNOBlock
+ >>> block = GNOBlock(width=16, edges_features=4)
+ >>> x = torch.randn(10, 16)
+ >>> edge_index = torch.randint(0, 10, (2, 30))
+ >>> edge_attr = torch.randn(30, 4)
+ >>> out = block(x, edge_index, edge_attr)
"""
def __init__(
diff --git a/pina/_src/model/block/integral.py b/pina/_src/model/block/integral.py
index 0bab4f07a..4bf6fcb72 100644
--- a/pina/_src/model/block/integral.py
+++ b/pina/_src/model/block/integral.py
@@ -6,6 +6,15 @@
class Integral:
"""
Class allowing integration for continous convolution.
+
+ :Example:
+
+ >>> from pina.model.block import Integral
+ >>> integral = Integral("discrete")
+ >>> x = torch.tensor([1.0, 2.0, 3.0])
+ >>> y = torch.tensor([4.0, 5.0, 6.0])
+ >>> idx = [2, 1]
+ >>> integral(x, y, idx)
"""
def __init__(self, param):
diff --git a/pina/_src/model/block/kan_block.py b/pina/_src/model/block/kan_block.py
index 77597d310..3a23ff3d4 100644
--- a/pina/_src/model/block/kan_block.py
+++ b/pina/_src/model/block/kan_block.py
@@ -21,6 +21,14 @@ class KANBlock(torch.nn.Module):
*KAN: Kolmogorov-Arnold Networks*.
DOI: `arXiv preprint arXiv:2404.19756.
`_
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import KANBlock
+ >>> block = KANBlock(input_dimensions=2, output_dimensions=1)
+ >>> x = torch.randn(10, 2)
+ >>> out = block(x)
"""
def __init__(
diff --git a/pina/_src/model/block/low_rank_block.py b/pina/_src/model/block/low_rank_block.py
index ad67b4dca..5e5952ce8 100644
--- a/pina/_src/model/block/low_rank_block.py
+++ b/pina/_src/model/block/low_rank_block.py
@@ -16,6 +16,17 @@ class LowRankBlock(torch.nn.Module):
(2023). *Neural operator: Learning maps between function
spaces with applications to PDEs*. Journal of Machine Learning
Research, 24(89), 1-97.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import LowRankBlock
+ >>> block = LowRankBlock(
+ ... input_dimensions=3, embedding_dimenion=20, rank=10
+ ... )
+ >>> x = torch.randn(10, 20)
+ >>> coords = torch.randn(10, 3)
+ >>> out = block(x, coords)
"""
def __init__(
diff --git a/pina/_src/model/block/message_passing/deep_tensor_network_block.py b/pina/_src/model/block/message_passing/deep_tensor_network_block.py
index ed19578b7..f00528676 100644
--- a/pina/_src/model/block/message_passing/deep_tensor_network_block.py
+++ b/pina/_src/model/block/message_passing/deep_tensor_network_block.py
@@ -28,6 +28,20 @@ class DeepTensorNetworkBlock(MessagePassing):
(2017). *Quantum-Chemical Insights from Deep Tensor Neural Networks*.
Nature Communications 8, 13890 (2017).
DOI: ``_.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block.message_passing import (
+ ... DeepTensorNetworkBlock
+ ... )
+ >>> block = DeepTensorNetworkBlock(
+ ... node_feature_dim=16, edge_feature_dim=4
+ ... )
+ >>> x = torch.randn(10, 16)
+ >>> edge_index = torch.randint(0, 10, (2, 30))
+ >>> edge_attr = torch.randn(30, 4)
+ >>> out = block(x, edge_index, edge_attr)
"""
def __init__(
diff --git a/pina/_src/model/block/message_passing/en_equivariant_network_block.py b/pina/_src/model/block/message_passing/en_equivariant_network_block.py
index 28a197230..37783e487 100644
--- a/pina/_src/model/block/message_passing/en_equivariant_network_block.py
+++ b/pina/_src/model/block/message_passing/en_equivariant_network_block.py
@@ -39,6 +39,16 @@ class EnEquivariantNetworkBlock(MessagePassing):
(2021). *E(n) Equivariant Graph Neural Networks.*
In International Conference on Machine Learning.
DOI: ``_.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block.message_passing import (
+ ... EnEquivariantNetworkBlock
+ ... )
+ >>> block = EnEquivariantNetworkBlock(
+ ... node_feature_dim=16, edge_feature_dim=4, pos_dim=3
+ ... )
"""
def __init__(
diff --git a/pina/_src/model/block/message_passing/equivariant_graph_neural_operator_block.py b/pina/_src/model/block/message_passing/equivariant_graph_neural_operator_block.py
index 8a0f30aed..680d4cf93 100644
--- a/pina/_src/model/block/message_passing/equivariant_graph_neural_operator_block.py
+++ b/pina/_src/model/block/message_passing/equivariant_graph_neural_operator_block.py
@@ -23,6 +23,16 @@ class EquivariantGraphNeuralOperatorBlock(torch.nn.Module):
*Equivariant Graph Neural Operator for Modeling 3D Dynamics*
DOI: `arXiv preprint arXiv:2401.11037.
`_
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block.message_passing import (
+ ... EquivariantGraphNeuralOperatorBlock
+ ... )
+ >>> block = EquivariantGraphNeuralOperatorBlock(
+ ... node_feature_dim=16, edge_feature_dim=4, pos_dim=3, modes=8
+ ... )
"""
def __init__(
diff --git a/pina/_src/model/block/message_passing/interaction_network_block.py b/pina/_src/model/block/message_passing/interaction_network_block.py
index 06fb39406..52d52b1e3 100644
--- a/pina/_src/model/block/message_passing/interaction_network_block.py
+++ b/pina/_src/model/block/message_passing/interaction_network_block.py
@@ -30,6 +30,19 @@ class InteractionNetworkBlock(MessagePassing):
Physics*.
In Advances in Neural Information Processing Systems (NeurIPS 2016).
DOI: ``_.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block.message_passing import (
+ ... InteractionNetworkBlock
+ ... )
+ >>> block = InteractionNetworkBlock(
+ ... node_feature_dim=16, hidden_dim=64
+ ... )
+ >>> x = torch.randn(10, 16)
+ >>> edge_index = torch.randint(0, 10, (2, 30))
+ >>> out = block(x, edge_index)
"""
def __init__(
diff --git a/pina/_src/model/block/message_passing/radial_field_network_block.py b/pina/_src/model/block/message_passing/radial_field_network_block.py
index ede0fb645..7d556ec85 100644
--- a/pina/_src/model/block/message_passing/radial_field_network_block.py
+++ b/pina/_src/model/block/message_passing/radial_field_network_block.py
@@ -33,6 +33,17 @@ class RadialFieldNetworkBlock(MessagePassing):
Densities*.
In International Conference on Machine Learning.
DOI: ``_.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block.message_passing import (
+ ... RadialFieldNetworkBlock
+ ... )
+ >>> block = RadialFieldNetworkBlock(node_feature_dim=16)
+ >>> x = torch.randn(10, 16)
+ >>> edge_index = torch.randint(0, 10, (2, 30))
+ >>> out = block(x, edge_index)
"""
def __init__(
diff --git a/pina/_src/model/block/orthogonal.py b/pina/_src/model/block/orthogonal.py
index 24021ada6..ce8ce0b4e 100644
--- a/pina/_src/model/block/orthogonal.py
+++ b/pina/_src/model/block/orthogonal.py
@@ -13,6 +13,14 @@ class OrthogonalBlock(torch.nn.Module):
Gram Schmidt orthogonalization, see
`here ` for
details.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import OrthogonalBlock
+ >>> block = OrthogonalBlock(dim=-1)
+ >>> x = torch.randn(5, 3)
+ >>> out = block(x)
"""
def __init__(self, dim=-1, requires_grad=True):
diff --git a/pina/_src/model/block/pirate_network_block.py b/pina/_src/model/block/pirate_network_block.py
index 752f81901..8759f4302 100644
--- a/pina/_src/model/block/pirate_network_block.py
+++ b/pina/_src/model/block/pirate_network_block.py
@@ -20,6 +20,15 @@ class PirateNetBlock(torch.nn.Module):
Networks*.
DOI: `arXiv preprint arXiv:2507.08972.
`_
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import PirateNetBlock
+ >>> block = PirateNetBlock(inner_size=64, activation=torch.nn.Tanh)
+ >>> x = torch.randn(10, 64)
+ >>> U, V = torch.randn(10, 64), torch.randn(10, 64)
+ >>> out = block(x, U, V)
"""
def __init__(self, inner_size, activation):
diff --git a/pina/_src/model/block/pod_block.py b/pina/_src/model/block/pod_block.py
index 5ea2a35af..7af5cce73 100644
--- a/pina/_src/model/block/pod_block.py
+++ b/pina/_src/model/block/pod_block.py
@@ -16,6 +16,15 @@ class PODBlock(torch.nn.Module):
.. note::
All the POD modes are stored in memory, avoiding to recompute them when
the rank changes, leading to increased memory usage.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import PODBlock
+ >>> block = PODBlock(rank=5)
+ >>> x = torch.randn(100, 20)
+ >>> block.fit(x)
+ >>> reduced = block(x)
"""
def __init__(self, rank, scale_coefficients=True):
diff --git a/pina/_src/model/block/rbf_block.py b/pina/_src/model/block/rbf_block.py
index 061e43109..ba8f82a20 100644
--- a/pina/_src/model/block/rbf_block.py
+++ b/pina/_src/model/block/rbf_block.py
@@ -130,6 +130,17 @@ class RBFBlock(torch.nn.Module):
It reproduces the implementation of :class:`scipy.interpolate.RBFBlock`
and it is inspired from the implementation in `torchrbf.
`_
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import RBFBlock
+ >>> block = RBFBlock(kernel="gaussian", epsilon=1.0)
+ >>> y = torch.randn(50, 2)
+ >>> d = torch.randn(50, 1)
+ >>> block.fit(y, d)
+ >>> x = torch.randn(10, 2)
+ >>> out = block(x)
"""
def __init__(
@@ -388,7 +399,7 @@ def kernel_vector(x, y, kernel_func):
Evaluate for all points ``x`` the radial functions with center ``y``.
:param torch.Tensor x: The tensor of points.
- :param torch.Tensor y: The tensor of centers.
+ :param torch.Tensor y: The tensor of centres.
:param str kernel_func: Radial basis function to use.
:return: The radial function values.
:rtype: torch.Tensor
diff --git a/pina/_src/model/block/residual.py b/pina/_src/model/block/residual.py
index d1e8134cc..c63102fc9 100644
--- a/pina/_src/model/block/residual.py
+++ b/pina/_src/model/block/residual.py
@@ -16,6 +16,16 @@ class ResidualBlock(nn.Module):
Proceedings of the IEEE conference on computer vision and pattern
recognition. 2016.
DOI: ``_.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import ResidualBlock
+ >>> block = ResidualBlock(
+ ... input_dim=10, output_dim=10, hidden_dim=20
+ ... )
+ >>> x = torch.randn(5, 10)
+ >>> out = block(x)
"""
def __init__(
@@ -88,6 +98,16 @@ class EnhancedLinear(torch.nn.Module):
This class is a wrapper for enhancing a linear layer with activation and/or
dropout.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import EnhancedLinear
+ >>> layer = EnhancedLinear(
+ ... torch.nn.Linear(10, 20), torch.nn.ReLU()
+ ... )
+ >>> x = torch.randn(5, 10)
+ >>> out = layer(x)
"""
def __init__(self, layer, activation=None, dropout=None):
diff --git a/pina/_src/model/block/spectral.py b/pina/_src/model/block/spectral.py
index fd5f48f6a..8a8440d0b 100644
--- a/pina/_src/model/block/spectral.py
+++ b/pina/_src/model/block/spectral.py
@@ -15,6 +15,16 @@ class SpectralConvBlock1D(nn.Module):
space.
The block expects an input of size [``batch``, ``input_numb_fields``, ``N``]
and returns an output of size [``batch``, ``output_numb_fields``, ``N``].
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import SpectralConvBlock1D
+ >>> block = SpectralConvBlock1D(
+ ... input_numb_fields=2, output_numb_fields=2, n_modes=16
+ ... )
+ >>> x = torch.randn(10, 2, 50)
+ >>> out = block(x)
"""
def __init__(self, input_numb_fields, output_numb_fields, n_modes):
@@ -106,6 +116,16 @@ class SpectralConvBlock2D(nn.Module):
[``batch``, ``input_numb_fields``, ``Nx``, ``Ny``]
and returns an output of size
[``batch``, ``output_numb_fields``, ``Nx``, ``Ny``].
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import SpectralConvBlock2D
+ >>> block = SpectralConvBlock2D(
+ ... input_numb_fields=2, output_numb_fields=2, n_modes=[8, 8]
+ ... )
+ >>> x = torch.randn(10, 2, 50, 50)
+ >>> out = block(x)
"""
def __init__(self, input_numb_fields, output_numb_fields, n_modes):
@@ -236,6 +256,16 @@ class SpectralConvBlock3D(nn.Module):
[``batch``, ``input_numb_fields``, ``Nx``, ``Ny``, ``Nz``]
and returns an output of size
[``batch``, ``output_numb_fields``, ``Nx``, ``Ny``, ``Nz``].
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model.block import SpectralConvBlock3D
+ >>> block = SpectralConvBlock3D(
+ ... input_numb_fields=2, output_numb_fields=2, n_modes=[4, 4, 4]
+ ... )
+ >>> x = torch.randn(10, 2, 20, 20, 20)
+ >>> out = block(x)
"""
def __init__(self, input_numb_fields, output_numb_fields, n_modes):
diff --git a/pina/_src/model/block/stride.py b/pina/_src/model/block/stride.py
index e802cddc0..54ca51f26 100644
--- a/pina/_src/model/block/stride.py
+++ b/pina/_src/model/block/stride.py
@@ -6,6 +6,17 @@
class Stride:
"""
Stride class for continuous convolution.
+
+ :Example:
+
+ >>> from pina.model.block import Stride
+ >>> stride_dict = {
+ ... "domain": [4, 4],
+ ... "start": [-4, 2],
+ ... "jump": [2, 2],
+ ... "direction": [1, 1],
+ ... }
+ >>> stride = Stride(stride_dict)
"""
def __init__(self, dict_):
diff --git a/pina/_src/model/equivariant_graph_neural_operator.py b/pina/_src/model/equivariant_graph_neural_operator.py
index 3aa7dde69..6adcafb6b 100644
--- a/pina/_src/model/equivariant_graph_neural_operator.py
+++ b/pina/_src/model/equivariant_graph_neural_operator.py
@@ -32,6 +32,15 @@ class EquivariantGraphNeuralOperator(torch.nn.Module):
*Equivariant Graph Neural Operator for Modeling 3D Dynamics*
DOI: `arXiv preprint arXiv:2401.11037.
`_
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model import EquivariantGraphNeuralOperator
+ >>> model = EquivariantGraphNeuralOperator(
+ ... n_egno_layers=2, node_feature_dim=16, edge_feature_dim=4,
+ ... pos_dim=3, modes=8
+ ... )
"""
def __init__(
diff --git a/pina/_src/model/feed_forward.py b/pina/_src/model/feed_forward.py
index fdf6bc91e..e5eca8e56 100644
--- a/pina/_src/model/feed_forward.py
+++ b/pina/_src/model/feed_forward.py
@@ -10,6 +10,16 @@ class FeedForward(torch.nn.Module):
"""
Feed Forward neural network model class, also known as Multi-layer
Perceptron.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model import FeedForward
+ >>> model = FeedForward(input_dimensions=2, output_dimensions=1)
+ >>> x = torch.randn(10, 2)
+ >>> out = model(x)
+ >>> out.shape
+ torch.Size([10, 1])
"""
def __init__(
@@ -118,6 +128,16 @@ class ResidualFeedForward(torch.nn.Module):
SIAM Journal on Scientific Computing 43.5 (2021): A3055-A3081.
DOI: `10.1137/20M1318043
`_
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model import ResidualFeedForward
+ >>> model = ResidualFeedForward(
+ ... input_dimensions=2, output_dimensions=1
+ ... )
+ >>> x = torch.randn(10, 2)
+ >>> out = model(x)
"""
def __init__(
diff --git a/pina/_src/model/fourier_neural_operator.py b/pina/_src/model/fourier_neural_operator.py
index 7517b39b4..b29076176 100644
--- a/pina/_src/model/fourier_neural_operator.py
+++ b/pina/_src/model/fourier_neural_operator.py
@@ -27,6 +27,18 @@ class FourierIntegralKernel(torch.nn.Module):
*Fourier neural operator for parametric partial differential equations*.
DOI: `arXiv preprint arXiv:2010.08895.
`_
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model._src.model.fourier_neural_operator import (
+ ... FourierIntegralKernel
+ ... )
+ >>> model = FourierIntegralKernel(
+ ... input_numb_fields=2, output_numb_fields=2, n_modes=16
+ ... )
+ >>> x = torch.randn(10, 2, 50)
+ >>> out = model(x)
"""
def __init__(
@@ -262,6 +274,19 @@ class FNO(KernelNeuralOperator):
*Fourier neural operator for parametric partial differential equations*.
DOI: `arXiv preprint arXiv:2010.08895.
`_
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model import FNO, FeedForward
+ >>> lifting_net = FeedForward(input_dimensions=3, output_dimensions=20)
+ >>> projecting_net = FeedForward(input_dimensions=20, output_dimensions=1)
+ >>> model = FNO(
+ ... lifting_net=lifting_net, projecting_net=projecting_net,
+ ... n_modes=16, dimensions=2
+ ... )
+ >>> x = torch.randn(10, 2, 50, 3)
+ >>> out = model(x)
"""
def __init__(
diff --git a/pina/_src/model/graph_neural_operator.py b/pina/_src/model/graph_neural_operator.py
index e4d844fcb..8b3c922ff 100644
--- a/pina/_src/model/graph_neural_operator.py
+++ b/pina/_src/model/graph_neural_operator.py
@@ -18,7 +18,19 @@ class GraphNeuralKernel(torch.nn.Module):
Liu, B., Bhattacharya, K., Stuart, A., Anandkumar, A. (2020).
*Neural Operator: Graph Kernel Network for Partial Differential
Equations*.
- DOI: `arXiv preprint arXiv:2003.03485 `_
+ DOI: `arXiv preprint arXiv:2003.03485 `_
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model._src.model.graph_neural_operator import (
+ ... GraphNeuralKernel
+ ... )
+ >>> model = GraphNeuralKernel(width=16, edge_features=4)
+ >>> x = torch.randn(10, 16)
+ >>> edge_index = torch.randint(0, 10, (2, 20))
+ >>> edge_attr = torch.randn(20, 4)
+ >>> out = model(x, edge_index, edge_attr)
"""
def __init__(
@@ -152,6 +164,18 @@ class GraphNeuralOperator(KernelNeuralOperator):
Equations*.
DOI: `arXiv preprint arXiv:2003.03485.
`_
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model import GraphNeuralOperator, FeedForward
+ >>> lifting_net = FeedForward(input_dimensions=3, output_dimensions=16)
+ >>> projecting_net = FeedForward(input_dimensions=16, output_dimensions=1)
+ >>> model = GraphNeuralOperator(
+ ... lifting_operator=lifting_net,
+ ... projection_operator=projecting_net,
+ ... edge_features=4
+ ... )
"""
def __init__(
diff --git a/pina/_src/model/kernel_neural_operator.py b/pina/_src/model/kernel_neural_operator.py
index 81d1be45d..4b9b54d79 100644
--- a/pina/_src/model/kernel_neural_operator.py
+++ b/pina/_src/model/kernel_neural_operator.py
@@ -43,6 +43,22 @@ class KernelNeuralOperator(torch.nn.Module):
*Neural operator: Learning maps between function spaces with
applications to PDEs*.
Journal of Machine Learning Research, 24(89), 1-97.
+
+ :Example:
+
+ >>> import torch
+ >>> from torch import nn
+ >>> from pina.model import KernelNeuralOperator
+ >>> lifting_net = nn.Linear(3, 20)
+ >>> integral_net = nn.Identity()
+ >>> projecting_net = nn.Linear(20, 1)
+ >>> model = KernelNeuralOperator(
+ ... lifting_operator=lifting_net,
+ ... integral_kernels=integral_net,
+ ... projection_operator=projecting_net
+ ... )
+ >>> x = torch.randn(10, 3)
+ >>> out = model(x)
"""
def __init__(self, lifting_operator, integral_kernels, projection_operator):
diff --git a/pina/_src/model/kolmogorov_arnold_network.py b/pina/_src/model/kolmogorov_arnold_network.py
index 1782aab4b..81fee7863 100644
--- a/pina/_src/model/kolmogorov_arnold_network.py
+++ b/pina/_src/model/kolmogorov_arnold_network.py
@@ -19,6 +19,16 @@ class KolmogorovArnoldNetwork(torch.nn.Module):
*KAN: Kolmogorov-Arnold Networks*.
DOI: `arXiv preprint arXiv:2404.19756.
`_
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model import KolmogorovArnoldNetwork
+ >>> model = KolmogorovArnoldNetwork(
+ ... layers=[2, 16, 1], spline_order=3, n_knots=10
+ ... )
+ >>> x = torch.randn(10, 2)
+ >>> out = model(x)
"""
def __init__(
diff --git a/pina/_src/model/low_rank_neural_operator.py b/pina/_src/model/low_rank_neural_operator.py
index 049894001..847e6d4c5 100644
--- a/pina/_src/model/low_rank_neural_operator.py
+++ b/pina/_src/model/low_rank_neural_operator.py
@@ -25,6 +25,20 @@ class LowRankNeuralOperator(KernelNeuralOperator):
*Neural operator: Learning maps between function spaces with
applications to PDEs*.
Journal of Machine Learning Research, 24(89), 1-97.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model import LowRankNeuralOperator, FeedForward
+ >>> lifting_net = FeedForward(input_dimensions=4, output_dimensions=20)
+ >>> projecting_net = FeedForward(input_dimensions=22, output_dimensions=1)
+ >>> model = LowRankNeuralOperator(
+ ... lifting_net, projecting_net,
+ ... field_indices=["f"], coordinates_indices=["x", "y", "z"],
+ ... n_kernel_layers=2, rank=10
+ ... )
+ >>> x = torch.randn(10, 5, 4)
+ >>> out = model(x)
"""
def __init__(
diff --git a/pina/_src/model/multi_feed_forward.py b/pina/_src/model/multi_feed_forward.py
index df8fb19e2..2f9dbf0fb 100644
--- a/pina/_src/model/multi_feed_forward.py
+++ b/pina/_src/model/multi_feed_forward.py
@@ -12,6 +12,17 @@ class MultiFeedForward(torch.nn.Module, ABC):
This model allows to create a network with multiple Feed Forward neural
networks combined together. The user is required to define the ``forward``
method to choose how to combine the networks.
+
+ :Example:
+
+ >>> from pina.model import MultiFeedForward
+ >>> class MyModel(MultiFeedForward):
+ ... def forward(self, x):
+ ... return self.ffn1(x) + self.ffn2(x)
+ >>> model = MyModel({
+ ... "ffn1": {"input_dimensions": 2, "output_dimensions": 1},
+ ... "ffn2": {"input_dimensions": 2, "output_dimensions": 1},
+ ... })
"""
def __init__(self, ffn_dict):
diff --git a/pina/_src/model/pirate_network.py b/pina/_src/model/pirate_network.py
index 09aad269d..122a3b27a 100644
--- a/pina/_src/model/pirate_network.py
+++ b/pina/_src/model/pirate_network.py
@@ -26,6 +26,16 @@ class PirateNet(torch.nn.Module):
Networks*.
DOI: `arXiv preprint arXiv:2507.08972.
`_
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model import PirateNet
+ >>> model = PirateNet(
+ ... input_dimension=2, inner_size=64, output_dimension=1
+ ... )
+ >>> x = torch.randn(10, 2)
+ >>> out = model(x)
"""
def __init__(
diff --git a/pina/_src/model/sindy.py b/pina/_src/model/sindy.py
index f69842a54..1e93550cc 100644
--- a/pina/_src/model/sindy.py
+++ b/pina/_src/model/sindy.py
@@ -39,6 +39,15 @@ class SINDy(torch.nn.Module):
Proceedings of the National Academy of Sciences, 113(15), 3932-3937.
DOI: `10.1073/pnas.1517384113
`_
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model import SINDy
+ >>> library = [lambda x: x, lambda x: x**2]
+ >>> model = SINDy(library=library, output_dimension=2)
+ >>> x = torch.randn(10, 2)
+ >>> out = model(x)
"""
def __init__(self, library, output_dimension):
diff --git a/pina/_src/model/spline_surface.py b/pina/_src/model/spline_surface.py
index 5550d761d..bb30b66ea 100644
--- a/pina/_src/model/spline_surface.py
+++ b/pina/_src/model/spline_surface.py
@@ -30,6 +30,14 @@ class SplineSurface(torch.nn.Module):
- :math:`X = \{ x_1, x_2, \dots, x_m \}` and
:math:`Y = \{ y_1, y_2, \dots, y_l \}` are the non-decreasing knot
vectors along the two directions.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.model import SplineSurface
+ >>> model = SplineSurface(orders=[3, 3])
+ >>> x = torch.tensor([[0.5, 0.3], [0.2, 0.8]])
+ >>> out = model(x)
"""
def __init__(self, orders, knots_u=None, knots_v=None, control_points=None):
diff --git a/pina/_src/optim/optimizer_interface.py b/pina/_src/optim/optimizer_interface.py
index b60e23624..87a6d6918 100644
--- a/pina/_src/optim/optimizer_interface.py
+++ b/pina/_src/optim/optimizer_interface.py
@@ -6,6 +6,14 @@
class OptimizerInterface(metaclass=ABCMeta):
"""
Abstract interface for all optimizers.
+
+ :Example:
+
+ >>> from pina.optim import TorchOptimizer
+ >>> import torch
+ >>> opt = TorchOptimizer(torch.optim.Adam, lr=0.01)
+ >>> isinstance(opt, OptimizerInterface)
+ True
"""
@abstractmethod
diff --git a/pina/_src/optim/scheduler_interface.py b/pina/_src/optim/scheduler_interface.py
index 55951ee0e..b1f0a184a 100644
--- a/pina/_src/optim/scheduler_interface.py
+++ b/pina/_src/optim/scheduler_interface.py
@@ -6,6 +6,15 @@
class SchedulerInterface(metaclass=ABCMeta):
"""
Abstract interface for all schedulers.
+
+ :Example:
+
+ >>> from pina.optim import TorchScheduler
+ >>> import torch
+ >>> sched = TorchScheduler(
+ ... torch.optim.lr_scheduler.StepLR, step_size=5)
+ >>> isinstance(sched, SchedulerInterface)
+ True
"""
@abstractmethod
diff --git a/pina/_src/optim/torch_optimizer.py b/pina/_src/optim/torch_optimizer.py
index a37bfbfec..794d9f839 100644
--- a/pina/_src/optim/torch_optimizer.py
+++ b/pina/_src/optim/torch_optimizer.py
@@ -11,8 +11,16 @@ class TorchOptimizer(OptimizerInterface):
This class wraps a ``torch.optim.Optimizer`` class and defers its
instantiation until runtime. It enables a consistent interface across
- different optimizer backends while leveraging PyTorch’s optimization
+ different optimizer backends while leveraging PyTorch's optimization
algorithms.
+
+ :Example:
+
+ >>> from pina.optim import TorchOptimizer
+ >>> import torch
+ >>> optimizer = TorchOptimizer(torch.optim.Adam, lr=0.001)
+ >>> optimizer.optimizer_class
+
"""
def __init__(self, optimizer_class, **kwargs):
diff --git a/pina/_src/optim/torch_scheduler.py b/pina/_src/optim/torch_scheduler.py
index f33b6020f..cb106726d 100644
--- a/pina/_src/optim/torch_scheduler.py
+++ b/pina/_src/optim/torch_scheduler.py
@@ -12,6 +12,15 @@ class TorchScheduler(SchedulerInterface):
This class wraps a ``torch.optim.lr_scheduler.LRScheduler`` class and defers
its instantiation until runtime, once the optimizer instance is available.
+
+ :Example:
+
+ >>> from pina.optim import TorchScheduler
+ >>> import torch
+ >>> scheduler = TorchScheduler(
+ ... torch.optim.lr_scheduler.StepLR, step_size=5)
+ >>> scheduler.scheduler_class
+
"""
def __init__(self, scheduler_class, **kwargs):
diff --git a/pina/_src/problem/inverse_problem.py b/pina/_src/problem/inverse_problem.py
index 7ee28bb96..74902ddfe 100644
--- a/pina/_src/problem/inverse_problem.py
+++ b/pina/_src/problem/inverse_problem.py
@@ -14,6 +14,21 @@ class InverseProblem(BaseProblem):
estimated from observed data.
This class is not meant to be instantiated directly.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.problem import InverseProblem
+ >>> from pina.domain import CartesianDomain
+ >>> class MyInverseProblem(InverseProblem):
+ ... @property
+ ... def unknown_parameter_domain(self):
+ ... return CartesianDomain({"k": [0.1, 5.0]})
+ ... @property
+ ... def conditions(self): return {}
+ >>> problem = MyInverseProblem()
+ >>> problem.unknown_variables
+ ['k']
"""
def __init__(self):
diff --git a/pina/_src/problem/parametric_problem.py b/pina/_src/problem/parametric_problem.py
index 12a9cd089..83a252fa2 100644
--- a/pina/_src/problem/parametric_problem.py
+++ b/pina/_src/problem/parametric_problem.py
@@ -15,6 +15,20 @@ class ParametricProblem(BaseProblem):
different evaluations and influence the solution.
This class is not meant to be instantiated directly.
+
+ :Example:
+
+ >>> from pina.problem import ParametricProblem
+ >>> from pina.domain import CartesianDomain
+ >>> class MyParametricProblem(ParametricProblem):
+ ... @property
+ ... def parameter_domain(self):
+ ... return CartesianDomain({"mu": [0.1, 10.0]})
+ ... @property
+ ... def conditions(self): return {}
+ >>> problem = MyParametricProblem()
+ >>> problem.parameters
+ ['mu']
"""
@property
diff --git a/pina/_src/problem/spatial_problem.py b/pina/_src/problem/spatial_problem.py
index 16ea9365b..4fd54f403 100644
--- a/pina/_src/problem/spatial_problem.py
+++ b/pina/_src/problem/spatial_problem.py
@@ -14,6 +14,20 @@ class SpatialProblem(BaseProblem):
dimensions) on which the solution is evaluated.
This class is not meant to be instantiated directly.
+
+ :Example:
+
+ >>> from pina.problem import SpatialProblem
+ >>> from pina.domain import CartesianDomain
+ >>> class MySpatialProblem(SpatialProblem):
+ ... @property
+ ... def spatial_domain(self):
+ ... return CartesianDomain({"x": [0, 1], "y": [0, 1]})
+ ... @property
+ ... def conditions(self): return {}
+ >>> problem = MySpatialProblem()
+ >>> problem.spatial_variables
+ ['x', 'y']
"""
@property
diff --git a/pina/_src/problem/time_dependent_problem.py b/pina/_src/problem/time_dependent_problem.py
index b81ab4778..f7b86d753 100644
--- a/pina/_src/problem/time_dependent_problem.py
+++ b/pina/_src/problem/time_dependent_problem.py
@@ -13,6 +13,20 @@ class TimeDependentProblem(BaseProblem):
variables represent the time at which the solution is evaluated.
This class is not meant to be instantiated directly.
+
+ :Example:
+
+ >>> from pina.problem import TimeDependentProblem
+ >>> from pina.domain import CartesianDomain
+ >>> class MyTimeProblem(TimeDependentProblem):
+ ... @property
+ ... def temporal_domain(self):
+ ... return CartesianDomain({"t": [0.0, 1.0]})
+ ... @property
+ ... def conditions(self): return {}
+ >>> problem = MyTimeProblem()
+ >>> problem.temporal_variables
+ ['t']
"""
@property
diff --git a/pina/_src/solver/autoregressive_ensemble_solver.py b/pina/_src/solver/autoregressive_ensemble_solver.py
index 27e00947a..0c34af129 100644
--- a/pina/_src/solver/autoregressive_ensemble_solver.py
+++ b/pina/_src/solver/autoregressive_ensemble_solver.py
@@ -41,9 +41,17 @@ class AutoregressiveEnsembleSolver(AutoregressiveMixin, EnsembleSolver):
differently to the total loss depending on its accumulated difficulty. Steps
with larger running losses are assigned larger weights, so that the solver
focuses more on parts of the rollout where prediction errors tend to
- accumulate. The parameter ``eps`` controls the strength of this effect:
+ accumulate. The parameter ``eps`` controls the strength of this effect:
``eps = 0`` disables adaptive weighting, while larger values increase the
influence of high-loss steps on the final training objective.
+
+ :Example:
+
+ >>> from pina.solver import AutoregressiveEnsembleSolver
+ >>> from pina.problem import PoissonProblem
+ >>> # solver = AutoregressiveEnsembleSolver(
+ >>> # problem=problem, models=models, eps=0.1
+ >>> # )
"""
# Accepted conditions types for this solver
diff --git a/pina/_src/solver/autoregressive_single_model_solver.py b/pina/_src/solver/autoregressive_single_model_solver.py
index 8d2f0b9ca..6ee434cfa 100644
--- a/pina/_src/solver/autoregressive_single_model_solver.py
+++ b/pina/_src/solver/autoregressive_single_model_solver.py
@@ -39,9 +39,17 @@ class AutoregressiveSingleModelSolver(AutoregressiveMixin, SingleModelSolver):
differently to the total loss depending on its accumulated difficulty. Steps
with larger running losses are assigned larger weights, so that the solver
focuses more on parts of the rollout where prediction errors tend to
- accumulate. The parameter ``eps`` controls the strength of this effect:
+ accumulate. The parameter ``eps`` controls the strength of this effect:
``eps = 0`` disables adaptive weighting, while larger values increase the
influence of high-loss steps on the final training objective.
+
+ :Example:
+
+ >>> from pina.solver import AutoregressiveSingleModelSolver
+ >>> from pina.problem import PoissonProblem
+ >>> # solver = AutoregressiveSingleModelSolver(
+ >>> # problem=problem, model=model, eps=0.1
+ >>> # )
"""
# Accepted conditions types for this solver
diff --git a/pina/_src/solver/base_solver.py b/pina/_src/solver/base_solver.py
index da6f5a60a..233154760 100644
--- a/pina/_src/solver/base_solver.py
+++ b/pina/_src/solver/base_solver.py
@@ -21,8 +21,7 @@ class BaseSolver(SolverInterface, metaclass=ABCMeta):
All solvers must inherit from this class and implement abstract methods
defined in :class:`~pina.solver.solver_interface.SolverInterface`.
- This class is not meant to be instantiated directly.
- """
+ This class is not meant to be instantiated directly."""
# Define the available reductions for loss computation
_AVAILABLE_REDUCTIONS = {
diff --git a/pina/_src/solver/causal_physics_informed_single_model_solver.py b/pina/_src/solver/causal_physics_informed_single_model_solver.py
index db243e020..f6d6e0726 100644
--- a/pina/_src/solver/causal_physics_informed_single_model_solver.py
+++ b/pina/_src/solver/causal_physics_informed_single_model_solver.py
@@ -76,6 +76,15 @@ class CausalPhysicsInformedSingleModelSolver(
This solver is compatible only with problems inheriting from
:class:`~pina.problem.time_dependent_problem.TimeDependentProblem`.
+
+ :Example:
+
+ >>> from pina.solver import CausalPhysicsInformedSingleModelSolver
+ >>> from pina.problem import PoissonProblem
+ >>> # solver = CausalPhysicsInformedSingleModelSolver(
+ >>> # problem=problem, model=model, eps=100.0, n_steps=10
+ >>> # )
+ >>> # solver.train()
"""
# Accepted conditions types for this solver
diff --git a/pina/_src/solver/competitive_physics_informed_solver.py b/pina/_src/solver/competitive_physics_informed_solver.py
index 70ed77030..a5a0f66c4 100644
--- a/pina/_src/solver/competitive_physics_informed_solver.py
+++ b/pina/_src/solver/competitive_physics_informed_solver.py
@@ -62,6 +62,15 @@ class CompetitivePhysicsInformedSolver(PhysicsInformedMixin, MultiModelSolver):
*Competitive physics informed networks.*
International Conference on Learning Representations, ICLR 2022.
`OpenReview Preprint `_.
+
+ :Example:
+
+ >>> from pina.solver import CompetitivePhysicsInformedSolver
+ >>> from pina.problem import PoissonProblem
+ >>> # solver = CompetitivePhysicsInformedSolver(
+ >>> # problem=problem, model=model
+ >>> # )
+ >>> # solver.train()
"""
# Accepted conditions types for this solver
diff --git a/pina/_src/solver/ensemble_solver.py b/pina/_src/solver/ensemble_solver.py
index d1a78a870..27ab6b02d 100644
--- a/pina/_src/solver/ensemble_solver.py
+++ b/pina/_src/solver/ensemble_solver.py
@@ -25,9 +25,16 @@ class EnsembleSolver(
handling, manual optimization, and condition-wise loss aggregation.
Subclasses can inherit from this class to implement solver-specific
- behavior while reusing the common logic for model registration, optimizer
+ behaviour while reusing the common logic for model registration, optimizer
and scheduler setup, manual optimization, loss evaluation, weighting, and
aggregation across problem conditions.
+
+ :Example:
+
+ >>> from pina.solver import EnsembleSolver
+ >>> from pina.problem import PoissonProblem
+ >>> # Typically used as a base class.
+ >>> # solver = EnsembleSolver(problem=problem, models=[model1, model2, model3])
"""
def __init__(
diff --git a/pina/_src/solver/gradient_physics_informed_single_model_solver.py b/pina/_src/solver/gradient_physics_informed_single_model_solver.py
index 8991420ce..3649ac7b1 100644
--- a/pina/_src/solver/gradient_physics_informed_single_model_solver.py
+++ b/pina/_src/solver/gradient_physics_informed_single_model_solver.py
@@ -61,6 +61,15 @@ class GradientPhysicsInformedSingleModelSolver(
Engineering, 393, 114823.
DOI: `10.1016/j.cma.2022.114823
`_.
+
+ :Example:
+
+ >>> from pina.solver import GradientPhysicsInformedSingleModelSolver
+ >>> from pina.problem import PoissonProblem
+ >>> # solver = GradientPhysicsInformedSingleModelSolver(
+ >>> # problem=problem, model=model, regularization_weight=0.1
+ >>> # )
+ >>> # solver.train()
"""
# Accepted conditions types for this solver
diff --git a/pina/_src/solver/multi_model_solver.py b/pina/_src/solver/multi_model_solver.py
index 3fdec7d9c..a5364ad26 100644
--- a/pina/_src/solver/multi_model_solver.py
+++ b/pina/_src/solver/multi_model_solver.py
@@ -24,10 +24,17 @@ class MultiModelSolver(
:class:`~pina._src.solver.base_solver.BaseSolver` with multi-model handling,
manual optimization, and condition-wise loss aggregation.
- Subclasses can inherit from this class to implement solver-specific behavior
+ Subclasses can inherit from this class to implement solver-specific behaviour
while reusing the common logic for model registration, optimizer and
scheduler setup, manual optimization, loss evaluation, weighting, and
aggregation across problem conditions.
+
+ :Example:
+
+ >>> from pina.solver import MultiModelSolver
+ >>> from pina.problem import PoissonProblem
+ >>> # Typically used as a base class.
+ >>> # solver = MultiModelSolver(problem=problem, models=[model1, model2])
"""
def __init__(
diff --git a/pina/_src/solver/physics_informed_ensemble_solver.py b/pina/_src/solver/physics_informed_ensemble_solver.py
index 15cc7e1e6..8dbd576ee 100644
--- a/pina/_src/solver/physics_informed_ensemble_solver.py
+++ b/pina/_src/solver/physics_informed_ensemble_solver.py
@@ -44,6 +44,15 @@ class PhysicsInformedEnsembleSolver(PhysicsInformedMixin, EnsembleSolver):
where :math:`\mathcal{L}` is the selected loss function, typically the
mean squared error.
+
+ :Example:
+
+ >>> from pina.solver import PhysicsInformedEnsembleSolver
+ >>> from pina.problem import PoissonProblem
+ >>> # solver = PhysicsInformedEnsembleSolver(
+ >>> # problem=problem, models=[model1, model2, model3]
+ >>> # )
+ >>> # solver.train()
"""
# Accepted conditions types for this solver
diff --git a/pina/_src/solver/physics_informed_single_model_solver.py b/pina/_src/solver/physics_informed_single_model_solver.py
index 1a5f783a2..1bcbb9eb7 100644
--- a/pina/_src/solver/physics_informed_single_model_solver.py
+++ b/pina/_src/solver/physics_informed_single_model_solver.py
@@ -49,6 +49,14 @@ class PhysicsInformedSingleModelSolver(PhysicsInformedMixin, SingleModelSolver):
Nature Reviews Physics, 3, 422-440.
DOI: `10.1038/s42254-021-00314-5
`_.
+
+ :Example:
+
+ >>> from pina.solver import PINN
+ >>> from pina.problem import PoissonProblem
+ >>> # problem = PoissonProblem()
+ >>> # solver = PINN(problem=problem, model=model)
+ >>> # solver.train()
"""
# Accepted conditions types for this solver
diff --git a/pina/_src/solver/rba_physics_informed_single_model_solver.py b/pina/_src/solver/rba_physics_informed_single_model_solver.py
index d19a8f229..412b38dbc 100644
--- a/pina/_src/solver/rba_physics_informed_single_model_solver.py
+++ b/pina/_src/solver/rba_physics_informed_single_model_solver.py
@@ -72,6 +72,15 @@ class RBAPhysicsInformedSingleModelSolver(
Computer Methods in Applied Mechanics and Engineering, 421, 116805.
DOI: `10.1016/j.cma.2024.116805
`_.
+
+ :Example:
+
+ >>> from pina.solver import RBAPhysicsInformedSingleModelSolver
+ >>> from pina.problem import PoissonProblem
+ >>> # solver = RBAPhysicsInformedSingleModelSolver(
+ >>> # problem=problem, model=model, eta=0.001, gamma=0.999
+ >>> # )
+ >>> # solver.train()
"""
# Accepted conditions types for this solver
diff --git a/pina/_src/solver/self_adaptive_physics_informed_solver.py b/pina/_src/solver/self_adaptive_physics_informed_solver.py
index 7f2b4032a..c9e0eef12 100644
--- a/pina/_src/solver/self_adaptive_physics_informed_solver.py
+++ b/pina/_src/solver/self_adaptive_physics_informed_solver.py
@@ -68,6 +68,15 @@ class SelfAdaptivePhysicsInformedSolver(PhysicsInformedMixin, MultiModelSolver):
Journal of Computational Physics, 474, 111722.
DOI: `10.1016/j.jcp.2022.111722
`_.
+
+ :Example:
+
+ >>> from pina.solver import SelfAdaptivePhysicsInformedSolver
+ >>> from pina.problem import PoissonProblem
+ >>> # solver = SelfAdaptivePhysicsInformedSolver(
+ >>> # problem=problem, model=model
+ >>> # )
+ >>> # solver.train()
"""
# Accepted conditions types for this solver
diff --git a/pina/_src/solver/single_model_solver.py b/pina/_src/solver/single_model_solver.py
index 265c431c9..71ade8b74 100644
--- a/pina/_src/solver/single_model_solver.py
+++ b/pina/_src/solver/single_model_solver.py
@@ -16,10 +16,17 @@ class SingleModelSolver(SingleModelMixin, ConditionAggregatorMixin, BaseSolver):
:class:`~pina._src.solver.base_solver.BaseSolver` with single-model handling
and condition-wise loss aggregation.
- Subclasses can inherit from this class to implement solver-specific behavior
+ Subclasses can inherit from this class to implement solver-specific behaviour
while reusing the common logic for model registration, optimizer and
scheduler setup, loss evaluation, weighting, and aggregation across problem
conditions.
+
+ :Example:
+
+ >>> from pina.solver import SingleModelSolver
+ >>> from pina.problem import PoissonProblem
+ >>> # Typically used as a base class.
+ >>> # solver = SingleModelSolver(problem=problem, model=model)
"""
def __init__(
diff --git a/pina/_src/solver/solver_interface.py b/pina/_src/solver/solver_interface.py
index c6cab1b18..be04119ce 100644
--- a/pina/_src/solver/solver_interface.py
+++ b/pina/_src/solver/solver_interface.py
@@ -13,6 +13,12 @@ class SolverInterface(lightning.pytorch.LightningModule, metaclass=ABCMeta):
By inheriting from this base class, solvers gain access to built-in training
loops, logging utilities, and optimization techniques.
+
+ :Example:
+
+ >>> from pina.solver import SolverInterface
+ >>> class MySolver(SolverInterface):
+ ... pass
"""
@abstractmethod
diff --git a/pina/_src/solver/supervised_ensemble_solver.py b/pina/_src/solver/supervised_ensemble_solver.py
index d602f3fe0..59c949559 100644
--- a/pina/_src/solver/supervised_ensemble_solver.py
+++ b/pina/_src/solver/supervised_ensemble_solver.py
@@ -33,6 +33,15 @@ class SupervisedEnsembleSolver(EnsembleSolver):
where :math:`\mathcal{L}` is the selected loss function, typically the
mean squared error.
+
+ :Example:
+
+ >>> from pina.solver import SupervisedEnsembleSolver
+ >>> from pina.problem import SupervisedProblem
+ >>> # solver = SupervisedEnsembleSolver(
+ >>> # problem=problem, models=[model1, model2, model3]
+ >>> # )
+ >>> # solver.train()
"""
# Accepted conditions types for this solver
diff --git a/pina/_src/solver/supervised_single_model_solver.py b/pina/_src/solver/supervised_single_model_solver.py
index 428de8db4..496d6c506 100644
--- a/pina/_src/solver/supervised_single_model_solver.py
+++ b/pina/_src/solver/supervised_single_model_solver.py
@@ -28,6 +28,15 @@ class SupervisedSingleModelSolver(SingleModelSolver):
where :math:`\mathcal{L}` is the selected loss function, typically the mean
squared error.
+
+ :Example:
+
+ >>> from pina.solver import SupervisedSingleModelSolver
+ >>> from pina.problem import SupervisedProblem
+ >>> # solver = SupervisedSingleModelSolver(
+ >>> # problem=problem, model=model
+ >>> # )
+ >>> # solver.train()
"""
# Accepted conditions types for this solver
diff --git a/pina/_src/weighting/base_weighting.py b/pina/_src/weighting/base_weighting.py
index 2208009cb..df68fc524 100644
--- a/pina/_src/weighting/base_weighting.py
+++ b/pina/_src/weighting/base_weighting.py
@@ -17,6 +17,15 @@ class BaseWeighting(WeightingInterface):
defined in :class:`~pina.weighting.weighting_interface.WeightingInterface`.
This class is not meant to be instantiated directly.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.weighting import ScalarWeighting
+ >>> weighting = ScalarWeighting(weights=1.0)
+ >>> losses = {"loss_a": torch.tensor(0.5), "loss_b": torch.tensor(0.3)}
+ >>> weighting.aggregate(losses)
+ tensor(0.8000)
"""
# Supported aggregation methods
diff --git a/pina/_src/weighting/linear_weighting.py b/pina/_src/weighting/linear_weighting.py
index e57962c81..6d5bb232f 100644
--- a/pina/_src/weighting/linear_weighting.py
+++ b/pina/_src/weighting/linear_weighting.py
@@ -12,6 +12,21 @@ class LinearWeighting(BaseWeighting):
transitioning from a set of initial values to corresponding final values.
The update follows a linear schedule and is applied at each epoch until the
specified target epoch is reached.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.weighting import LinearWeighting
+ >>> initial = {"residual": 1.0, "data": 0.5}
+ >>> final = {"residual": 0.1, "data": 1.0}
+ >>> weighting = LinearWeighting(
+ ... initial_weights=initial,
+ ... final_weights=final,
+ ... target_epoch=100,
+ ... )
+ >>> # Weights are interpolated linearly over the first 100 epochs
+ >>> losses = {"residual": torch.tensor(0.1), "data": torch.tensor(0.2)}
+ >>> # The update_weights method is called internally via aggregate
"""
def __init__(self, initial_weights, final_weights, target_epoch):
diff --git a/pina/_src/weighting/no_weighting.py b/pina/_src/weighting/no_weighting.py
index 89507409e..9644d6128 100644
--- a/pina/_src/weighting/no_weighting.py
+++ b/pina/_src/weighting/no_weighting.py
@@ -7,6 +7,16 @@ class _NoWeighting(ScalarWeighting):
This is a special case of scalar weighting where a unit weight is assigned
to every loss term, resulting in no reweighting.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.weighting import ScalarWeighting
+ >>> # Equivalent to no weighting with unit weights:
+ >>> weighting = ScalarWeighting(weights=1.0)
+ >>> losses = {"loss": torch.tensor(0.5)}
+ >>> weighting.aggregate(losses)
+ tensor(0.5000)
"""
def __init__(self):
diff --git a/pina/_src/weighting/ntk_weighting.py b/pina/_src/weighting/ntk_weighting.py
index 702d0655c..f103bdf62 100644
--- a/pina/_src/weighting/ntk_weighting.py
+++ b/pina/_src/weighting/ntk_weighting.py
@@ -23,6 +23,13 @@ class NeuralTangentKernelWeighting(BaseWeighting):
A neural tangent kernel perspective*. Journal of
Computational Physics 449 (2022): 110768.
DOI: `10.1016 `_.
+
+ :Example:
+
+ >>> from pina.weighting import NeuralTangentKernelWeighting
+ >>> weighting = NeuralTangentKernelWeighting(alpha=0.5)
+ >>> # Typically used within a PINA solver:
+ >>> # solver = PINN(problem=problem, weighting=weighting)
"""
def __init__(self, update_every_n_epochs=1, alpha=0.5):
diff --git a/pina/_src/weighting/scalar_weighting.py b/pina/_src/weighting/scalar_weighting.py
index d977abf67..1e6a5686d 100644
--- a/pina/_src/weighting/scalar_weighting.py
+++ b/pina/_src/weighting/scalar_weighting.py
@@ -11,6 +11,20 @@ class ScalarWeighting(BaseWeighting):
This scheme assigns a constant multiplicative weight to each loss term,
without adapting over time. The same weight can be applied to all terms,
or distinct weights can be specified for individual conditions.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.weighting import ScalarWeighting
+ >>> # Uniform weighting
+ >>> weighting = ScalarWeighting(weights=1.0)
+ >>> losses = {"residual": torch.tensor(0.1), "data": torch.tensor(0.2)}
+ >>> weighting.aggregate(losses)
+ tensor(0.3000)
+ >>> # Per-condition weighting
+ >>> weighting = ScalarWeighting(weights={"residual": 0.5, "data": 2.0})
+ >>> weighting.aggregate(losses)
+ tensor(0.4500)
"""
def __init__(self, weights):
diff --git a/pina/_src/weighting/self_adaptive_weighting.py b/pina/_src/weighting/self_adaptive_weighting.py
index d954fe635..31c7ccc31 100644
--- a/pina/_src/weighting/self_adaptive_weighting.py
+++ b/pina/_src/weighting/self_adaptive_weighting.py
@@ -26,6 +26,13 @@ class SelfAdaptiveWeighting(BaseWeighting):
Networks*.
DOI: `arXiv preprint arXiv:2507.08972.
`_
+
+ :Example:
+
+ >>> from pina.weighting import SelfAdaptiveWeighting
+ >>> weighting = SelfAdaptiveWeighting(update_every_n_epochs=5)
+ >>> # Typically used within a PINA solver:
+ >>> # solver = PINN(problem=problem, weighting=weighting)
"""
def __init__(self, update_every_n_epochs=1):
diff --git a/pina/_src/weighting/weighting_interface.py b/pina/_src/weighting/weighting_interface.py
index 7871a5f55..8f72145dd 100644
--- a/pina/_src/weighting/weighting_interface.py
+++ b/pina/_src/weighting/weighting_interface.py
@@ -6,6 +6,15 @@
class WeightingInterface(metaclass=ABCMeta):
"""
Abstract interface for all weighting schemas.
+
+ :Example:
+
+ >>> import torch
+ >>> from pina.weighting import ScalarWeighting
+ >>> weighting = ScalarWeighting(weights={"loss_1": 0.5, "loss_2": 1.0})
+ >>> losses = {"loss_1": torch.tensor(0.1), "loss_2": torch.tensor(0.2)}
+ >>> weighting.aggregate(losses)
+ tensor(0.2500)
"""
@abstractmethod
diff --git a/pina/adaptive_function/__init__.py b/pina/adaptive_function/__init__.py
index d41f25ccd..7898a429a 100644
--- a/pina/adaptive_function/__init__.py
+++ b/pina/adaptive_function/__init__.py
@@ -4,6 +4,15 @@
SiLU, Tanh, etc.) augmented with trainable weights, as well as specialized
functions like SIREN, designed to improve convergence in PINNs and Neural
Operators.
+
+:Example:
+
+ >>> from pina.adaptive_function import AdaptiveTanh, AdaptiveReLU
+ >>> import torch
+ >>> act = AdaptiveTanh()
+ >>> x = torch.rand(5, 3)
+ >>> act(x).shape
+ torch.Size([5, 3])
"""
__all__ = [
diff --git a/pina/callback/__init__.py b/pina/callback/__init__.py
index a6b2e3973..c123fc6e8 100644
--- a/pina/callback/__init__.py
+++ b/pina/callback/__init__.py
@@ -3,6 +3,12 @@
This module provides specialized callbacks for training Scientific Machine
Learning models, including adaptive sample refinement (R3), optimizer
switching logic, and data normalization utilities.
+
+:Example:
+
+ >>> from pina.callback import MetricTracker, PINAProgressBar
+ >>> tracker = MetricTracker()
+ >>> # bar = PINAProgressBar()
"""
__all__ = [
diff --git a/pina/condition/__init__.py b/pina/condition/__init__.py
index 5ae1cc177..10cc189b0 100644
--- a/pina/condition/__init__.py
+++ b/pina/condition/__init__.py
@@ -4,6 +4,15 @@
equations, experimental data, and neural network targets to specific spatial
domains or graph structures. It supports various input-target mappings including
tensor-based, graph-based, and equation-based constraints.
+
+:Example:
+
+ >>> from pina.condition import InputTargetCondition
+ >>> import torch
+ >>> condition = InputTargetCondition(
+ ... input_points=torch.rand(10, 2),
+ ... target_points=torch.rand(10, 1),
+ ... )
"""
__all__ = [
diff --git a/pina/data/__init__.py b/pina/data/__init__.py
index 1ebcf2b9f..16b31b06f 100644
--- a/pina/data/__init__.py
+++ b/pina/data/__init__.py
@@ -1,4 +1,10 @@
-"""Module containing utilities for dataset and data loader management."""
+"""Module containing utilities for dataset and data loader management.
+
+:Example:
+
+ >>> from pina.data import DataModule
+ >>> # datamodule = DataModule(solver=solver, batch_size=32)
+"""
__all__ = [
"DataModule",
diff --git a/pina/data/manager.py b/pina/data/manager.py
index 1441cee12..eaf1943f6 100644
--- a/pina/data/manager.py
+++ b/pina/data/manager.py
@@ -1,4 +1,10 @@
-"""Module for condition data management."""
+"""Module for condition data management.
+
+:Example:
+
+ >>> from pina.data.manager import _DataManager, _GraphDataManager
+ >>> # Internal API used by DataModule for batch management
+"""
__all__ = [
"_BatchManager",
diff --git a/pina/domain/__init__.py b/pina/domain/__init__.py
index 6782563db..3bd39226f 100644
--- a/pina/domain/__init__.py
+++ b/pina/domain/__init__.py
@@ -3,6 +3,13 @@
This module provides tools for defining the physical space of a problem,
including primitive shapes (Cartesian, Ellipsoid, Simplex) and set-theoretic
operations (Union, Intersection, etc.) for building complex geometries.
+
+:Example:
+
+ >>> from pina.domain import CartesianDomain, EllipsoidDomain, Union
+ >>> left = CartesianDomain({'x': [0, 1], 'y': [0, 1]})
+ >>> right = CartesianDomain({'x': [2, 3], 'y': [0, 1]})
+ >>> domain = Union([left, right])
"""
__all__ = [
diff --git a/pina/equation/__init__.py b/pina/equation/__init__.py
index ae9a385bd..fda827380 100644
--- a/pina/equation/__init__.py
+++ b/pina/equation/__init__.py
@@ -6,6 +6,13 @@
pre-defined physical models such as Poisson, Helmholtz, and Wave equations,
along with equations for common derivative-based constraints, such as
FixedValue, FixedGradient, FixedFlux, and FixedLaplacian.
+
+:Example:
+
+ >>> from pina.equation import Equation, SystemEquation
+ >>> from pina.equation.zoo import PoissonEquation, FixedValue
+ >>> eq = PoissonEquation()
+ >>> bc = FixedValue(value=0.0)
"""
__all__ = [
diff --git a/pina/equation/zoo.py b/pina/equation/zoo.py
index 4febb63e6..134a1d457 100644
--- a/pina/equation/zoo.py
+++ b/pina/equation/zoo.py
@@ -1,4 +1,12 @@
-"""Module for implemented equations."""
+"""Module for implemented equations.
+
+:Example:
+
+ >>> from pina.equation.zoo import PoissonEquation, FixedValue, Laplace
+ >>> poisson = PoissonEquation()
+ >>> dirichlet = FixedValue(value=0.0)
+ >>> laplace_eq = Laplace()
+"""
__all__ = [
"AdvectionEquation",
diff --git a/pina/graph.py b/pina/graph.py
index 04c6374f5..20814f248 100644
--- a/pina/graph.py
+++ b/pina/graph.py
@@ -2,6 +2,16 @@
This module exposes core graph types used to define spatial relationships
between points, such as fixed-radius and k-nearest neighbor (KNN) structures.
+
+:Example:
+
+ >>> from pina.graph import KNNGraph, RadiusGraph
+ >>> import torch
+ >>> graph = KNNGraph(k=3)
+ >>> x = torch.rand(10, 2)
+ >>> edge_index = graph(x)
+ >>> edge_index.shape
+ torch.Size([2, 30])
"""
from pina._src.core.graph import Graph, RadiusGraph, KNNGraph
diff --git a/pina/loss/__init__.py b/pina/loss/__init__.py
index 280cbf76a..c9a468db8 100644
--- a/pina/loss/__init__.py
+++ b/pina/loss/__init__.py
@@ -1,4 +1,16 @@
-"""Module for loss functions."""
+"""Module for loss functions.
+
+:Example:
+
+ >>> from pina.loss import LpLoss
+ >>> import torch
+ >>> loss_fn = LpLoss(p=2)
+ >>> x = torch.rand(10, 3)
+ >>> y = torch.rand(10, 3)
+ >>> loss = loss_fn(x, y)
+ >>> loss.ndim
+ 0
+"""
__all__ = [
"DualLossInterface",
diff --git a/pina/model/__init__.py b/pina/model/__init__.py
index ee221c17e..24455492b 100644
--- a/pina/model/__init__.py
+++ b/pina/model/__init__.py
@@ -1,4 +1,18 @@
-"""Module for the Neural model classes."""
+"""Module for the Neural model classes.
+
+:Example:
+
+ >>> from pina.model import FeedForward
+ >>> import torch
+ >>> model = FeedForward(
+ ... input_dimensions=2,
+ ... output_dimensions=1,
+ ... layers=[20, 20],
+ ... )
+ >>> x = torch.rand(5, 2)
+ >>> model(x).shape
+ torch.Size([5, 1])
+"""
__all__ = [
"FeedForward",
diff --git a/pina/model/block/__init__.py b/pina/model/block/__init__.py
index e9e8e793d..0adf3cb0a 100644
--- a/pina/model/block/__init__.py
+++ b/pina/model/block/__init__.py
@@ -4,6 +4,15 @@
ranging from standard units (Residual, Enhanced Linear) to specialized layers
for Scientific Machine Learning, including Neural Operator blocks (FNO, GNO,
AVNO), spectral convolutions, and coordinate embeddings (Fourier Features).
+
+:Example:
+
+ >>> from pina.model.block import ResidualBlock, FourierFeatureEmbedding
+ >>> import torch
+ >>> block = ResidualBlock(input_dimension=10, output_dimension=10)
+ >>> x = torch.rand(5, 10)
+ >>> block(x).shape
+ torch.Size([5, 10])
"""
__all__ = [
diff --git a/pina/model/block/message_passing.py b/pina/model/block/message_passing.py
index 652e9dbde..8a6814813 100644
--- a/pina/model/block/message_passing.py
+++ b/pina/model/block/message_passing.py
@@ -1,4 +1,15 @@
-"""Module for the message passing blocks of the graph neural models."""
+"""Module for the message passing blocks of the graph neural models.
+
+:Example:
+
+ >>> from pina.model.block.message_passing import (
+ ... InteractionNetworkBlock,
+ ... DeepTensorNetworkBlock,
+ ... )
+ >>> import torch
+ >>> block = InteractionNetworkBlock(input_dim=3, hidden_dim=16)
+ >>> # block processes graph-structured data
+"""
__all__ = [
"InteractionNetworkBlock",
diff --git a/pina/operator.py b/pina/operator.py
index fcd214804..28dab6143 100644
--- a/pina/operator.py
+++ b/pina/operator.py
@@ -4,6 +4,16 @@
laplacian, advection) implemented using automatic differentiation. It includes
both high-level general operators and optimized 'fast' variants for improved
computational efficiency during training.
+
+:Example:
+
+ >>> from pina.operator import grad, div, laplacian
+ >>> import torch
+ >>> x = torch.rand(10, 2, requires_grad=True)
+ >>> f = x.pow(2).sum(dim=1, keepdim=True)
+ >>> g = grad(f, x)
+ >>> g.shape
+ torch.Size([10, 2])
"""
from pina._src.core.operator import (
diff --git a/pina/optim/__init__.py b/pina/optim/__init__.py
index f88b85e7a..5bcf1f6a0 100644
--- a/pina/optim/__init__.py
+++ b/pina/optim/__init__.py
@@ -1,4 +1,11 @@
-"""Module for the Optimizers and Schedulers."""
+"""Module for the Optimizers and Schedulers.
+
+:Example:
+
+ >>> from pina.optim import TorchOptimizer
+ >>> import torch
+ >>> optim = TorchOptimizer(torch.optim.Adam, lr=1e-3)
+"""
__all__ = [
"OptimizerInterface",
diff --git a/pina/problem/__init__.py b/pina/problem/__init__.py
index 3248c22e5..7f8c3e475 100644
--- a/pina/problem/__init__.py
+++ b/pina/problem/__init__.py
@@ -1,4 +1,13 @@
-"""Module for the Problems."""
+"""Module for the Problems.
+
+:Example:
+
+ >>> from pina.problem import SpatialProblem
+ >>> from pina.domain import CartesianDomain
+ >>> class MyProblem(SpatialProblem):
+ ... output_variables = ['u']
+ ... domains = {'domain': CartesianDomain({'x': [0, 1]})}
+"""
__all__ = [
"ProblemInterface",
diff --git a/pina/problem/zoo.py b/pina/problem/zoo.py
index 47b204425..591c6c51d 100644
--- a/pina/problem/zoo.py
+++ b/pina/problem/zoo.py
@@ -1,4 +1,12 @@
-"""Module for implemented problems."""
+"""Module for implemented problems.
+
+:Example:
+
+ >>> from pina.problem.zoo import Poisson2DSquareProblem, BurgersProblem
+ >>> problem = Poisson2DSquareProblem()
+ >>> problem.output_variables
+ ['u']
+"""
__all__ = [
"SupervisedProblem",
diff --git a/pina/solver/__init__.py b/pina/solver/__init__.py
index 44b6aa690..7380f19bb 100644
--- a/pina/solver/__init__.py
+++ b/pina/solver/__init__.py
@@ -1,4 +1,12 @@
-"""Module for all solvers in PINA."""
+"""Module for all solvers in PINA.
+
+:Example:
+
+ >>> from pina.solver import PhysicsInformedSingleModelSolver
+ >>> from pina.model import FeedForward
+ >>> model = FeedForward(2, 1, [20, 20])
+ >>> # solver = PhysicsInformedSingleModelSolver(problem=problem, model=model)
+"""
__all__ = [
"SolverInterface",
diff --git a/pina/solver/mixin.py b/pina/solver/mixin.py
index 53ab1acc4..f9330f2c8 100644
--- a/pina/solver/mixin.py
+++ b/pina/solver/mixin.py
@@ -1,4 +1,14 @@
-"""Module for solver mixins."""
+"""Module for solver mixins.
+
+:Example:
+
+ >>> from pina.solver.mixin import (
+ ... PhysicsInformedMixin,
+ ... SingleModelMixin,
+ ... AutoregressiveMixin,
+ ... )
+ >>> # Mixins are composed to build solver classes
+"""
__all__ = [
"SingleModelMixin",
diff --git a/pina/trainer.py b/pina/trainer.py
index 5cd598b4c..698830ade 100644
--- a/pina/trainer.py
+++ b/pina/trainer.py
@@ -1,4 +1,10 @@
-"""Public API for Trainer."""
+"""Public API for Trainer.
+
+:Example:
+
+ >>> from pina.trainer import Trainer
+ >>> # trainer = Trainer(solver=solver, max_epochs=1000)
+"""
from pina._src.core.trainer import Trainer
diff --git a/pina/type_checker.py b/pina/type_checker.py
index cfa886da3..62d93f989 100644
--- a/pina/type_checker.py
+++ b/pina/type_checker.py
@@ -4,6 +4,13 @@
annotations at runtime. This ensures that PINA components receive inputs
adhering to expected specifications, improving the robustness of the
scientific computing pipeline.
+
+:Example:
+
+ >>> from pina.type_checker import enforce_types
+ >>> @enforce_types
+ ... def compute(x: float, y: int) -> float:
+ ... return x ** y
"""
from pina._src.core.type_checker import enforce_types
diff --git a/pina/utils.py b/pina/utils.py
index 8e40ae9cd..671e4632c 100644
--- a/pina/utils.py
+++ b/pina/utils.py
@@ -4,6 +4,16 @@
This module provides helper functions to manage tensor operations and ensure
data consistency across the PINA framework, supporting robust input checking
and seamless data merging.
+
+:Example:
+
+ >>> from pina.utils import merge_tensors, check_consistency
+ >>> import torch
+ >>> a = torch.rand(3, 2)
+ >>> b = torch.rand(3, 2)
+ >>> merged = merge_tensors(a, b)
+ >>> merged.shape
+ torch.Size([6, 2])
"""
from pina._src.core.utils import (
diff --git a/pina/weighting/__init__.py b/pina/weighting/__init__.py
index d4eb46716..206ae6c30 100644
--- a/pina/weighting/__init__.py
+++ b/pina/weighting/__init__.py
@@ -1,4 +1,10 @@
-"""Module for weighting strategies in multi-objective optimization."""
+"""Module for weighting strategies in multi-objective optimization.
+
+:Example:
+
+ >>> from pina.weighting import LinearWeighting, ScalarWeighting
+ >>> weighting = LinearWeighting(weights=[0.3, 0.7])
+"""
__all__ = [
"WeightingInterface",