update doc
This commit is contained in:
committed by
FilippoOlivo
parent
ae1fd2680f
commit
480140dd31
@@ -11,11 +11,11 @@ The high-level structure of the package is depicted in our API.
|
|||||||
|
|
||||||
The pipeline to solve differential equations with PINA follows just five steps:
|
The pipeline to solve differential equations with PINA follows just five steps:
|
||||||
|
|
||||||
1. Define the `Problem`_ the user aim to solve
|
1. Define the `Problems`_ the user aim to solve
|
||||||
2. Generate data using built in `Domains`_, or load high level simulation results as :doc:`LabelTensor <label_tensor>`
|
2. Generate data using built in `Geometrical Domains`_, or load high level simulation results as :doc:`LabelTensor <label_tensor>`
|
||||||
3. Choose or build one or more `Models`_ to solve the problem
|
3. Choose or build one or more `Models`_ to solve the problem
|
||||||
4. Choose a solver across PINA available `Solvers`_, or build one using the :doc:`SolverInterface <solver/solver_interface>`
|
4. Choose a solver across PINA available `Solvers`_, or build one using the :doc:`SolverInterface <solver/solver_interface>`
|
||||||
5. Train the model with the PINA :doc:`Trainer <solver/solver_interface>`, enhance the train with `Callback`_
|
5. Train the model with the PINA :doc:`Trainer <solver/solver_interface>`, enhance the train with `Callbacks`_
|
||||||
|
|
||||||
|
|
||||||
Trainer, Dataset and Datamodule
|
Trainer, Dataset and Datamodule
|
||||||
@@ -34,6 +34,7 @@ Data Types
|
|||||||
|
|
||||||
LabelTensor <label_tensor.rst>
|
LabelTensor <label_tensor.rst>
|
||||||
Graph <graph/graph.rst>
|
Graph <graph/graph.rst>
|
||||||
|
LabelBatch <graph/label_batch.rst>
|
||||||
|
|
||||||
|
|
||||||
Graphs Structures
|
Graphs Structures
|
||||||
@@ -41,7 +42,6 @@ Graphs Structures
|
|||||||
.. toctree::
|
.. toctree::
|
||||||
:titlesonly:
|
:titlesonly:
|
||||||
|
|
||||||
Graph <graph/graph.rst>
|
|
||||||
GraphBuilder <graph/graph_builder.rst>
|
GraphBuilder <graph/graph_builder.rst>
|
||||||
RadiusGraph <graph/radius_graph.rst>
|
RadiusGraph <graph/radius_graph.rst>
|
||||||
KNNGraph <graph/knn_graph.rst>
|
KNNGraph <graph/knn_graph.rst>
|
||||||
@@ -98,7 +98,8 @@ Models
|
|||||||
FNO <model/fourier_neural_operator.rst>
|
FNO <model/fourier_neural_operator.rst>
|
||||||
AveragingNeuralOperator <model/average_neural_operator.rst>
|
AveragingNeuralOperator <model/average_neural_operator.rst>
|
||||||
LowRankNeuralOperator <model/low_rank_neural_operator.rst>
|
LowRankNeuralOperator <model/low_rank_neural_operator.rst>
|
||||||
GraphNeuralOperator <model/>
|
GraphNeuralOperator <model/graph_neural_operator.rst>
|
||||||
|
GraphNeuralKernel <model/graph_neural_operator_integral_kernel.rst>
|
||||||
|
|
||||||
Blocks
|
Blocks
|
||||||
-------------
|
-------------
|
||||||
@@ -112,7 +113,10 @@ Blocks
|
|||||||
Fourier Block <model/block/fourier_block.rst>
|
Fourier Block <model/block/fourier_block.rst>
|
||||||
Averaging Block <model/block/average_neural_operator_block.rst>
|
Averaging Block <model/block/average_neural_operator_block.rst>
|
||||||
Low Rank Block <model/block/low_rank_block.rst>
|
Low Rank Block <model/block/low_rank_block.rst>
|
||||||
|
Graph Neural Operator Block <model/block/gno_block.rst>
|
||||||
|
Continuous Convolution Interface <model/block/convolution_interface.rst>
|
||||||
Continuous Convolution Block <model/block/convolution.rst>
|
Continuous Convolution Block <model/block/convolution.rst>
|
||||||
|
Orthogonal Block <model/block/orthogonal.rst>
|
||||||
|
|
||||||
|
|
||||||
Reduction and Embeddings
|
Reduction and Embeddings
|
||||||
@@ -144,7 +148,7 @@ Adaptive Activation Functions
|
|||||||
.. toctree::
|
.. toctree::
|
||||||
:titlesonly:
|
:titlesonly:
|
||||||
|
|
||||||
Adaptive Function Interface <adaptive_function/AdaptiveFunctionInterface.rst>
|
Adaptive Function Interface <adaptive_function/AdaptiveActivationFunctionInterface.rst>
|
||||||
Adaptive ReLU <adaptive_function/AdaptiveReLU.rst>
|
Adaptive ReLU <adaptive_function/AdaptiveReLU.rst>
|
||||||
Adaptive Sigmoid <adaptive_function/AdaptiveSigmoid.rst>
|
Adaptive Sigmoid <adaptive_function/AdaptiveSigmoid.rst>
|
||||||
Adaptive Tanh <adaptive_function/AdaptiveTanh.rst>
|
Adaptive Tanh <adaptive_function/AdaptiveTanh.rst>
|
||||||
@@ -165,10 +169,10 @@ Equations and Differential Operators
|
|||||||
.. toctree::
|
.. toctree::
|
||||||
:titlesonly:
|
:titlesonly:
|
||||||
|
|
||||||
EquationInterface <equation.equation_interface.rst>
|
EquationInterface <equation/equation_interface.rst>
|
||||||
Equation <equation.equation.rst>
|
Equation <equation/equation.rst>
|
||||||
SystemEquation <equation.system_equation.rst>
|
SystemEquation <equation/system_equation.rst>
|
||||||
Equation Factory <equation.equation_factory.rst>
|
Equation Factory <equation/equation_factory.rst>
|
||||||
Differential Operators <operator.rst>
|
Differential Operators <operator.rst>
|
||||||
|
|
||||||
|
|
||||||
@@ -200,7 +204,7 @@ Problems Zoo
|
|||||||
|
|
||||||
|
|
||||||
Geometrical Domains
|
Geometrical Domains
|
||||||
---------------------
|
--------------------
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:titlesonly:
|
:titlesonly:
|
||||||
@@ -222,8 +226,8 @@ Domain Operations
|
|||||||
Difference <domain/difference_domain.rst>
|
Difference <domain/difference_domain.rst>
|
||||||
Exclusion <domain/exclusion_domain.rst>
|
Exclusion <domain/exclusion_domain.rst>
|
||||||
|
|
||||||
Callback
|
Callbacks
|
||||||
--------------------
|
-----------
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:titlesonly:
|
:titlesonly:
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ AdaptiveActivationFunctionInterface
|
|||||||
|
|
||||||
.. currentmodule:: pina.adaptive_function.adaptive_function_interface
|
.. currentmodule:: pina.adaptive_function.adaptive_function_interface
|
||||||
|
|
||||||
.. automodule:: pina.adaptive_function.adaptive_functiontion_interface
|
.. automodule:: pina.adaptive_function.adaptive_function_interface
|
||||||
:members:
|
:members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
Processing callbacks
|
Processing callbacks
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
.. currentmodule:: pina.callbacks.processing_callback
|
.. currentmodule:: pina.callback.processing_callback
|
||||||
.. autoclass:: MetricTracker
|
.. autoclass:: MetricTracker
|
||||||
:members:
|
:members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
@@ -4,6 +4,6 @@ Domain
|
|||||||
|
|
||||||
.. automodule:: pina.domain.domain_interface
|
.. automodule:: pina.domain.domain_interface
|
||||||
|
|
||||||
.. autoclass:: Domain
|
.. autoclass:: DomainInterface
|
||||||
:members:
|
:members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
9
docs/source/_rst/graph/label_batch.rst
Normal file
9
docs/source/_rst/graph/label_batch.rst
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
LabelBatch
|
||||||
|
===========
|
||||||
|
.. currentmodule:: pina.graph
|
||||||
|
|
||||||
|
|
||||||
|
.. autoclass:: LabelBatch
|
||||||
|
:members:
|
||||||
|
:private-members:
|
||||||
|
:show-inheritance:
|
||||||
8
docs/source/_rst/model/block/convolution_interface.rst
Normal file
8
docs/source/_rst/model/block/convolution_interface.rst
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
Continuous Convolution Interface
|
||||||
|
==================================
|
||||||
|
.. currentmodule:: pina.model.block.convolution
|
||||||
|
|
||||||
|
.. autoclass:: BaseContinuousConv
|
||||||
|
:members:
|
||||||
|
:show-inheritance:
|
||||||
|
:noindex:
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
FourierIntegralKernel
|
FourierIntegralKernel
|
||||||
=========================
|
=========================
|
||||||
.. currentmodule:: pina.model.fno
|
.. currentmodule:: pina.model.fourier_neural_operator
|
||||||
|
|
||||||
.. autoclass:: FourierIntegralKernel
|
.. autoclass:: FourierIntegralKernel
|
||||||
:members:
|
:members:
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
GraphNeuralKernel
|
||||||
|
=======================
|
||||||
|
.. currentmodule:: pina.model.graph_neural_operator
|
||||||
|
|
||||||
|
.. autoclass:: GraphNeuralKernel
|
||||||
|
:members:
|
||||||
|
:show-inheritance:
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
CausalPINN
|
CausalPINN
|
||||||
==============
|
==============
|
||||||
.. currentmodule:: pina.solver.physic_informed_solver.causalpinn
|
.. currentmodule:: pina.solver.physic_informed_solver.causal_pinn
|
||||||
|
|
||||||
.. autoclass:: CausalPINN
|
.. autoclass:: CausalPINN
|
||||||
:members:
|
:members:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
RBAPINN
|
RBAPINN
|
||||||
========
|
========
|
||||||
.. currentmodule:: pina.solver.physic_informed_solver.rbapinn
|
.. currentmodule:: pina.solver.physic_informed_solver.rba_pinn
|
||||||
|
|
||||||
.. autoclass:: RBAPINN
|
.. autoclass:: RBAPINN
|
||||||
:members:
|
:members:
|
||||||
|
|||||||
@@ -1,46 +1,35 @@
|
|||||||
PINA Tutorials
|
PINA Tutorials
|
||||||
==============
|
======================
|
||||||
|
|
||||||
|
|
||||||
In this folder we collect useful tutorials in order to understand the principles and the potential of **PINA**.
|
In this folder we collect useful tutorials in order to understand the principles and the potential of **PINA**.
|
||||||
|
|
||||||
Getting started with PINA
|
Getting started with PINA
|
||||||
-------------------------
|
-------------------------
|
||||||
.. toctree::
|
|
||||||
:maxdepth: 3
|
|
||||||
:titlesonly:
|
|
||||||
|
|
||||||
`Introduction to PINA for Physics Informed Neural Networks training <tutorials/tutorial1/tutorial.html>`_
|
- `Introduction to PINA for Physics Informed Neural Networks training <tutorial1/tutorial.html>`_
|
||||||
`Introduction to PINA Equation class <tutorials/tutorial12/tutorial.html>`_
|
- `Introduction to PINA Equation class <tutorial12/tutorial.html>`_
|
||||||
`PINA and PyTorch Lightning, training tips and visualizations <tutorials/tutorial11/tutorial.html>`_
|
- `PINA and PyTorch Lightning, training tips and visualizations <tutorial11/tutorial.html>`_
|
||||||
`Building custom geometries with PINA Location class <tutorials/tutorial6/tutorial.html>`_
|
- `Building custom geometries with PINA Location class <tutorial6/tutorial.html>`_
|
||||||
|
|
||||||
|
|
||||||
Physics Informed Neural Networks
|
Physics Informed Neural Networks
|
||||||
--------------------------------
|
--------------------------------
|
||||||
.. toctree::
|
|
||||||
:maxdepth: 3
|
|
||||||
:titlesonly:
|
|
||||||
|
|
||||||
`Two dimensional Poisson problem using Extra Features Learning <tutorials/tutorial2/tutorial.html>`_
|
- `Two dimensional Poisson problem using Extra Features Learning <tutorial2/tutorial.html>`_
|
||||||
`Two dimensional Wave problem with hard constraint <tutorials/tutorial3/tutorial.html>`_
|
- `Two dimensional Wave problem with hard constraint <tutorial3/tutorial.html>`_
|
||||||
`Resolution of a 2D Poisson inverse problem <tutorials/tutorial7/tutorial.html>`_
|
- `Resolution of a 2D Poisson inverse problem <tutorial7/tutorial.html>`_
|
||||||
`Periodic Boundary Conditions for Helmotz Equation <tutorials/tutorial9/tutorial.html>`_
|
- `Periodic Boundary Conditions for Helmotz Equation <tutorial9/tutorial.html>`_
|
||||||
`Multiscale PDE learning with Fourier Feature Network <tutorials/tutorial13/tutorial.html>`_
|
- `Multiscale PDE learning with Fourier Feature Network <tutorial13/tutorial.html>`_
|
||||||
|
|
||||||
Neural Operator Learning
|
Neural Operator Learning
|
||||||
------------------------
|
------------------------
|
||||||
.. toctree::
|
|
||||||
:maxdepth: 3
|
|
||||||
:titlesonly:
|
|
||||||
|
|
||||||
`Two dimensional Darcy flow using the Fourier Neural Operator <tutorials/tutorial5/tutorial.html>`_
|
- `Two dimensional Darcy flow using the Fourier Neural Operator <tutorial5/tutorial.html>`_
|
||||||
`Time dependent Kuramoto Sivashinsky equation using the Averaging Neural Operator <tutorials/tutorial10/tutorial.html>`_
|
- `Time dependent Kuramoto Sivashinsky equation using the Averaging Neural Operator <tutorial10/tutorial.html>`_
|
||||||
|
|
||||||
Supervised Learning
|
Supervised Learning
|
||||||
-------------------
|
-------------------
|
||||||
.. toctree::
|
|
||||||
:maxdepth: 3
|
|
||||||
:titlesonly:
|
|
||||||
|
|
||||||
`Unstructured convolutional autoencoder via continuous convolution <tutorials/tutorial4/tutorial.html>`_
|
- `Unstructured convolutional autoencoder via continuous convolution <tutorial4/tutorial.html>`_
|
||||||
`POD-RBF and POD-NN for reduced order modeling <tutorials/tutorial8/tutorial.html>`_
|
- `POD-RBF and POD-NN for reduced order modeling <tutorial8/tutorial.html>`_
|
||||||
|
|||||||
@@ -19,84 +19,84 @@ import importlib.metadata
|
|||||||
|
|
||||||
|
|
||||||
# -- Project information -----------------------------------------------------
|
# -- Project information -----------------------------------------------------
|
||||||
_DISTRIBUTION_METADATA = importlib.metadata.metadata('pina-mathlab')
|
_DISTRIBUTION_METADATA = importlib.metadata.metadata("pina-mathlab")
|
||||||
project = _DISTRIBUTION_METADATA['Name']
|
project = _DISTRIBUTION_METADATA["Name"]
|
||||||
copyright = _DISTRIBUTION_METADATA['License-File']
|
copyright = _DISTRIBUTION_METADATA["License-File"]
|
||||||
author = "PINA contributors"
|
author = "PINA Contributors"
|
||||||
version = _DISTRIBUTION_METADATA['Version']
|
version = _DISTRIBUTION_METADATA["Version"]
|
||||||
|
|
||||||
|
|
||||||
sys.path.insert(0, os.path.abspath('../sphinx_extensions')) # extension to remove paramref link from lightinig
|
sys.path.insert(
|
||||||
|
0, os.path.abspath("../sphinx_extensions")
|
||||||
|
)
|
||||||
|
|
||||||
# -- General configuration ------------------------------------------------
|
# -- General configuration ------------------------------------------------
|
||||||
|
|
||||||
extensions = [
|
extensions = [
|
||||||
'sphinx.ext.autodoc',
|
"sphinx.ext.autodoc",
|
||||||
'sphinx.ext.autosummary',
|
"sphinx.ext.autosummary",
|
||||||
'sphinx.ext.doctest',
|
"sphinx.ext.doctest",
|
||||||
'sphinx.ext.napoleon',
|
"sphinx.ext.napoleon",
|
||||||
'sphinx.ext.intersphinx',
|
"sphinx.ext.intersphinx",
|
||||||
'sphinx.ext.todo',
|
"sphinx.ext.todo",
|
||||||
'sphinx.ext.coverage',
|
"sphinx.ext.coverage",
|
||||||
'sphinx.ext.viewcode',
|
"sphinx.ext.viewcode",
|
||||||
'sphinx.ext.mathjax',
|
"sphinx.ext.mathjax",
|
||||||
'sphinx.ext.intersphinx',
|
"sphinx.ext.intersphinx",
|
||||||
'paramref_extension', # this extension is made to remove paramref links from lightining doc
|
"paramref_extension", # this extension is made to remove paramref links from lightining doc
|
||||||
'sphinx_copybutton',
|
"sphinx_copybutton",
|
||||||
'sphinx_design'
|
"sphinx_design",
|
||||||
]
|
]
|
||||||
|
|
||||||
# The root document.
|
|
||||||
root_doc = 'index'
|
|
||||||
|
|
||||||
# List of patterns, relative to source directory, that match files and
|
# List of patterns, relative to source directory, that match files and
|
||||||
# directories to ignore when looking for source files.
|
# directories to ignore when looking for source files.
|
||||||
# This pattern also affects html_static_path and html_extra_path.
|
# This pattern also affects html_static_path and html_extra_path.
|
||||||
exclude_patterns = ['_build', 'docstrings', 'nextgen', 'Thumbs.db', '.DS_Store']
|
exclude_patterns = ["build", "docstrings", "nextgen", "Thumbs.db", ".DS_Store"]
|
||||||
|
|
||||||
# The reST default role (used for this markup: `text`) to use for all documents.
|
# The reST default role (used for this markup: `text`) to use for all documents.
|
||||||
#default_role = 'literal'
|
# default_role = 'literal'
|
||||||
|
|
||||||
# Generate the API documentation when building
|
# Generate the API documentation when building
|
||||||
autosummary_generate = True
|
autosummary_generate = True
|
||||||
numpydoc_show_class_members = False
|
numpydoc_show_class_members = False
|
||||||
|
|
||||||
intersphinx_mapping = {
|
intersphinx_mapping = {
|
||||||
'python': ('http://docs.python.org/3', None),
|
"python": ("http://docs.python.org/3", None),
|
||||||
'matplotlib': ('https://matplotlib.org/stable', None),
|
"matplotlib": ("https://matplotlib.org/stable", None),
|
||||||
'torch': ('https://pytorch.org/docs/stable/', None),
|
"torch": ("https://pytorch.org/docs/stable/", None),
|
||||||
'lightning.pytorch': ("https://lightning.ai/docs/pytorch/stable/", None),
|
"lightning.pytorch": ("https://lightning.ai/docs/pytorch/stable/", None),
|
||||||
}
|
"torch_geometric": (
|
||||||
|
"https://pytorch-geometric.readthedocs.io/en/latest/",
|
||||||
|
None,
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
nitpicky = True
|
# nitpicky = True
|
||||||
nitpick_ignore = [
|
# nitpick_ignore = [
|
||||||
# ('py:meth', 'lightning.pytorch.core.module.LightningModule.log'),
|
# ("py:meth", "lightning.pytorch.core.module.LightningModule.log"),
|
||||||
# ('py:meth', 'lightning.pytorch.core.module.LightningModule.log_dict'),
|
# ("py:meth", "lightning.pytorch.core.module.LightningModule.log_dict"),
|
||||||
# ('py:exc', 'MisconfigurationException'),
|
# ("py:exc", "MisconfigurationException"),
|
||||||
# ('py:func', 'torch.inference_mode'),
|
# ("py:func", "torch.inference_mode"),
|
||||||
# ('py:func', 'torch.no_grad'),
|
# ("py:func", "torch.no_grad"),
|
||||||
# ('py:class', 'torch.utils.data.DistributedSampler'),
|
# ("py:class", "torch.utils.data.DistributedSampler"),
|
||||||
# ('py:class', 'pina.model.layers.convolution.BaseContinuousConv'),
|
# ("py:class", "pina.model.layers.convolution.BaseContinuousConv"),
|
||||||
# ('py:class', 'Module'),
|
# ("py:class", "Module"),
|
||||||
# ('py:class', 'torch.nn.modules.loss._Loss'), # TO FIX
|
# ("py:class", "torch.nn.modules.loss._Loss"), # TO FIX
|
||||||
# ('py:class', 'torch.optim.LRScheduler'), # TO FIX
|
# ("py:class", "torch.optim.LRScheduler"), # TO FIX
|
||||||
|
# ]
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
# Add any paths that contain templates here, relative to this directory.
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
templates_path = ['_templates']
|
templates_path = ["_templates"]
|
||||||
|
|
||||||
# The suffix(es) of source filenames.
|
# The suffix(es) of source filenames.
|
||||||
# You can specify multiple suffix as a list of string:
|
source_suffix = ".rst"
|
||||||
# source_suffix = ['.rst', '.md']
|
|
||||||
source_suffix = '.rst'
|
|
||||||
|
|
||||||
# The master toctree document.
|
# The master toctree document.
|
||||||
master_doc = 'index'
|
master_doc = "index"
|
||||||
|
|
||||||
# autoclass
|
# autoclass
|
||||||
autoclass_content = 'both'
|
autoclass_content = "both"
|
||||||
|
|
||||||
# The version info for the project you're documenting, acts as replacement for
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
# |version| and |release|, also used in various other places throughout the
|
# |version| and |release|, also used in various other places throughout the
|
||||||
@@ -108,7 +108,7 @@ release = version
|
|||||||
#
|
#
|
||||||
# This is also used if you do content translation via gettext catalogs.
|
# This is also used if you do content translation via gettext catalogs.
|
||||||
# Usually you set "language" from the command line for these cases.
|
# Usually you set "language" from the command line for these cases.
|
||||||
language = 'en'
|
language = "en"
|
||||||
|
|
||||||
# List of patterns, relative to source directory, that match files and
|
# List of patterns, relative to source directory, that match files and
|
||||||
# directories to ignore when looking for source files.
|
# directories to ignore when looking for source files.
|
||||||
@@ -122,7 +122,7 @@ add_function_parentheses = True
|
|||||||
add_module_names = False
|
add_module_names = False
|
||||||
|
|
||||||
# The name of the Pygments (syntax highlighting) style to use.
|
# The name of the Pygments (syntax highlighting) style to use.
|
||||||
pygments_style = 'sphinx'
|
pygments_style = "sphinx"
|
||||||
|
|
||||||
# A list of ignored prefixes for module index sortins as "systems = False
|
# A list of ignored prefixes for module index sortins as "systems = False
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ viewcode_import = True
|
|||||||
|
|
||||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||||
# a list of builtin themes.
|
# a list of builtin themes.
|
||||||
html_theme = 'pydata_sphinx_theme'
|
html_theme = "pydata_sphinx_theme"
|
||||||
|
|
||||||
# Theme options are theme-specific and customize the look and feel of a theme
|
# Theme options are theme-specific and customize the look and feel of a theme
|
||||||
# further. For a list of options available for each theme, see the
|
# further. For a list of options available for each theme, see the
|
||||||
@@ -151,7 +151,7 @@ html_theme = 'pydata_sphinx_theme'
|
|||||||
# html_theme_options = {}
|
# html_theme_options = {}
|
||||||
|
|
||||||
# Add any paths that contain custom themes here, relative to this directory.
|
# Add any paths that contain custom themes here, relative to this directory.
|
||||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
# html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||||
|
|
||||||
# The name of an image file (relative to this directory) to place at the top
|
# The name of an image file (relative to this directory) to place at the top
|
||||||
# of the sidebar.
|
# of the sidebar.
|
||||||
@@ -185,7 +185,7 @@ html_theme_options = {
|
|||||||
|
|
||||||
# If not ''i, a 'Last updated on:' timestamp is inserted at every page bottom,
|
# If not ''i, a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||||
# using the given strftime format.
|
# using the given strftime format.
|
||||||
html_last_updated_fmt = '%b %d, %Y'
|
html_last_updated_fmt = "%b %d, %Y"
|
||||||
|
|
||||||
# If false, no index is generated.
|
# If false, no index is generated.
|
||||||
html_use_index = True
|
html_use_index = True
|
||||||
@@ -197,40 +197,52 @@ html_show_sourcelink = True
|
|||||||
html_show_copyright = True
|
html_show_copyright = True
|
||||||
|
|
||||||
# Output file base name for HTML help builder.
|
# Output file base name for HTML help builder.
|
||||||
htmlhelp_basename = 'pinadoc'
|
htmlhelp_basename = "pinadoc"
|
||||||
|
|
||||||
|
# Link to external html files
|
||||||
|
html_extra_path = ["tutorials"]
|
||||||
|
|
||||||
|
# Avoid side bar for html files
|
||||||
|
html_sidebars = {
|
||||||
|
"_tutorial": [],
|
||||||
|
"_team": [],
|
||||||
|
"_cite": [],
|
||||||
|
"_contributing": [],
|
||||||
|
"_installation": [],
|
||||||
|
"_LICENSE": [],
|
||||||
|
}
|
||||||
|
|
||||||
# -- Options for LaTeX output ---------------------------------------------
|
# -- Options for LaTeX output ---------------------------------------------
|
||||||
|
|
||||||
latex_elements = {
|
latex_elements = {
|
||||||
# The paper size ('letterpaper' or 'a4paper').
|
# The paper size ('letterpaper' or 'a4paper').
|
||||||
'papersize': 'a4paper',
|
"papersize": "a4paper",
|
||||||
|
|
||||||
# The font size ('10pt', '11pt' or '12pt').
|
# The font size ('10pt', '11pt' or '12pt').
|
||||||
'pointsize': '20pt',
|
"pointsize": "20pt",
|
||||||
|
|
||||||
# Additional stuff for the LaTeX preamble.
|
# Additional stuff for the LaTeX preamble.
|
||||||
'preamble': '',
|
"preamble": "",
|
||||||
|
|
||||||
# Latex figure (float) alignment
|
# Latex figure (float) alignment
|
||||||
'figure_align': 'htbp',
|
"figure_align": "htbp",
|
||||||
}
|
}
|
||||||
|
|
||||||
# Grouping the document tree into LaTeX files. List of tuples
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
# (source start file, target name, title,
|
# (source start file, target name, title,
|
||||||
# author, documentclass [howto, manual, or own class]).
|
# author, documentclass [howto, manual, or own class]).
|
||||||
latex_documents = [
|
latex_documents = [
|
||||||
(master_doc, 'pina.tex', u'PINA Documentation',
|
(
|
||||||
u'PINA contributors', 'manual'),
|
master_doc,
|
||||||
|
"pina.tex",
|
||||||
|
"PINA Documentation",
|
||||||
|
"PINA contributors",
|
||||||
|
"manual",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
# -- Options for manual page output ---------------------------------------
|
# -- Options for manual page output ---------------------------------------
|
||||||
|
|
||||||
# One entry per manual page. List of tuples
|
# One entry per manual page. List of tuples
|
||||||
# (source start file, name, description, authors, manual section).
|
# (source start file, name, description, authors, manual section).
|
||||||
man_pages = [
|
man_pages = [(master_doc, "pina", "PINA Documentation", [author], 1)]
|
||||||
(master_doc, 'pina', u'PINA Documentation',
|
|
||||||
[author], 1)
|
|
||||||
]
|
|
||||||
|
|
||||||
# -- Options for Texinfo output -------------------------------------------
|
# -- Options for Texinfo output -------------------------------------------
|
||||||
|
|
||||||
@@ -238,11 +250,20 @@ man_pages = [
|
|||||||
# (source start file, target name, title, author,
|
# (source start file, target name, title, author,
|
||||||
# dir menu entry, description, category)
|
# dir menu entry, description, category)
|
||||||
texinfo_documents = [
|
texinfo_documents = [
|
||||||
(master_doc, 'pina', u'PINA Documentation',
|
(
|
||||||
author, 'pina', 'One line description of project.',
|
master_doc,
|
||||||
'Miscellaneous'),
|
"pina",
|
||||||
|
"PINA Documentation",
|
||||||
|
author,
|
||||||
|
"pina",
|
||||||
|
"One line description of project.",
|
||||||
|
"Miscellaneous",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
||||||
# texinfo_no_detailmenu = False
|
# texinfo_no_detailmenu = False
|
||||||
autodoc_member_order = 'bysource'
|
autodoc_member_order = "bysource"
|
||||||
|
|
||||||
|
# Do consider meth ending with _ (needed for in-place methods of torch)
|
||||||
|
strip_signature_backslash = True
|
||||||
|
|||||||
@@ -9,32 +9,32 @@ Welcome to PINA’s documentation!
|
|||||||
.. grid-item::
|
.. grid-item::
|
||||||
|
|
||||||
.. image:: index_files/tutorial_13_3.png
|
.. image:: index_files/tutorial_13_3.png
|
||||||
:target: tutorials/tutorial2/tutorial.html
|
:target: tutorial2/tutorial.html
|
||||||
|
|
||||||
.. grid-item::
|
.. grid-item::
|
||||||
|
|
||||||
.. image:: index_files/tutorial_32_0.png
|
.. image:: index_files/tutorial_32_0.png
|
||||||
:target: tutorials/tutorial4/tutorial.html
|
:target: tutorial4/tutorial.html
|
||||||
|
|
||||||
.. grid-item::
|
.. grid-item::
|
||||||
|
|
||||||
.. image:: index_files/tutorial_13_01.png
|
.. image:: index_files/tutorial_13_01.png
|
||||||
:target: tutorials/tutorial9/tutorial.html
|
:target: tutorial9/tutorial.html
|
||||||
|
|
||||||
.. grid-item::
|
.. grid-item::
|
||||||
|
|
||||||
.. image:: index_files/tutorial_36_0.png
|
.. image:: index_files/tutorial_36_0.png
|
||||||
:target: tutorials/tutorial6/tutorial.html
|
:target: tutorial6/tutorial.html
|
||||||
|
|
||||||
.. grid-item::
|
.. grid-item::
|
||||||
|
|
||||||
.. image:: index_files/tutorial_15_0.png
|
.. image:: index_files/tutorial_15_0.png
|
||||||
:target: tutorials/tutorial13/tutorial.html
|
:target: tutorial13/tutorial.html
|
||||||
|
|
||||||
.. grid-item::
|
.. grid-item::
|
||||||
|
|
||||||
.. image:: index_files/tutorial_5_0.png
|
.. image:: index_files/tutorial_5_0.png
|
||||||
:target: tutorials/tutorial10/tutorial.html
|
:target: tutorial10/tutorial.html
|
||||||
|
|
||||||
.. grid:: 1 1 3 3
|
.. grid:: 1 1 3 3
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ Welcome to PINA’s documentation!
|
|||||||
an open-source Python library providing an intuitive interface for
|
an open-source Python library providing an intuitive interface for
|
||||||
solving differential equations using PINNs, NOs or both together.
|
solving differential equations using PINNs, NOs or both together.
|
||||||
|
|
||||||
Based on `PyTorch <https://pytorch.org/>`_ and `PyTorchLightning <https://lightning.ai/docs/pytorch/stable/>`_, **PINA** offers a simple and intuitive way to formalize a specific (differential) problem
|
Based on `PyTorch <https://pytorch.org/>`_, `PyTorchLightning <https://lightning.ai/docs/pytorch/stable/>`_, and `PyG <https://pytorch-geometric.readthedocs.io/en/latest/>`_, **PINA** offers a simple and intuitive way to formalize a specific (differential) problem
|
||||||
and solve it using neural networks . The approximated solution of a differential equation
|
and solve it using neural networks . The approximated solution of a differential equation
|
||||||
can be implemented using PINA in a few lines of code thanks to the intuitive and user-friendly interface.
|
can be implemented using PINA in a few lines of code thanks to the intuitive and user-friendly interface.
|
||||||
|
|
||||||
@@ -63,9 +63,9 @@ Welcome to PINA’s documentation!
|
|||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|
||||||
Installing <_installation>
|
|
||||||
Tutorial <_tutorial>
|
|
||||||
API <_rst/_code>
|
API <_rst/_code>
|
||||||
|
Tutorial <_tutorial>
|
||||||
|
Installing <_installation>
|
||||||
Team & Foundings <_team.rst>
|
Team & Foundings <_team.rst>
|
||||||
Contributing <_contributing>
|
Contributing <_contributing>
|
||||||
License <_LICENSE.rst>
|
License <_LICENSE.rst>
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
from docutils.parsers.rst.roles import register_local_role
|
from docutils.parsers.rst.roles import register_local_role
|
||||||
|
|
||||||
|
|
||||||
def paramref_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
|
def paramref_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
|
||||||
# Simply replace :paramref: with :param:
|
# Simply replace :paramref: with :param:
|
||||||
new_role = nodes.literal(text=text[1:])
|
new_role = nodes.literal(text=text[1:])
|
||||||
return [new_role], []
|
return [new_role], []
|
||||||
|
|
||||||
def setup(app):
|
|
||||||
register_local_role('paramref', paramref_role)
|
|
||||||
|
|
||||||
|
def setup(app):
|
||||||
|
register_local_role("paramref", paramref_role)
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ from ..utils import check_consistency, is_function
|
|||||||
|
|
||||||
class AdaptiveActivationFunctionInterface(torch.nn.Module, metaclass=ABCMeta):
|
class AdaptiveActivationFunctionInterface(torch.nn.Module, metaclass=ABCMeta):
|
||||||
r"""
|
r"""
|
||||||
The
|
The :class:`AdaptiveActivationFunctionInterface`
|
||||||
:class:`~pina.adaptive_function.adaptive_func_interface.\
|
|
||||||
AdaptiveActivationFunctionInterface`
|
|
||||||
class makes a :class:`torch.nn.Module` activation function into an adaptive
|
class makes a :class:`torch.nn.Module` activation function into an adaptive
|
||||||
trainable activation function. If one wants to create an adpative activation
|
trainable activation function. If one wants to create an adpative activation
|
||||||
function, this class must be use as base class.
|
function, this class must be use as base class.
|
||||||
|
|||||||
@@ -16,29 +16,23 @@ from ..collector import Collector
|
|||||||
|
|
||||||
|
|
||||||
class DummyDataloader:
|
class DummyDataloader:
|
||||||
"""
|
|
||||||
Dataloader used when batch size is ``None``. It returns the entire dataset
|
|
||||||
in a single batch.
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, dataset):
|
def __init__(self, dataset):
|
||||||
"""
|
"""
|
||||||
Preprare a dataloader object which will return the entire dataset
|
Prepare a dataloader object that returns the entire dataset in a single
|
||||||
in a single batch. Depending on the number of GPUs, the dataset is
|
batch. Depending on the number of GPUs, the dataset is managed
|
||||||
managed as follows:
|
as follows:
|
||||||
|
|
||||||
- **Distributed Environment** (multiple GPUs):
|
- **Distributed Environment** (multiple GPUs): Divides dataset across
|
||||||
- Divides the dataset across processes using the rank and world
|
processes using the rank and world size. Fetches only portion of
|
||||||
size.
|
data corresponding to the current process.
|
||||||
- Fetches only the portion of data corresponding to the current
|
- **Non-Distributed Environment** (single GPU): Fetches the entire
|
||||||
process.
|
dataset.
|
||||||
- **Non-Distributed Environment** (single GPU):
|
|
||||||
- Fetches the entire dataset.
|
|
||||||
|
|
||||||
:param dataset: The dataset object to be processed.
|
:param PinaDataset dataset: The dataset object to be processed.
|
||||||
:type dataset: PinaDataset
|
|
||||||
|
|
||||||
.. note:: This data loader is used when the batch size is ``None``.
|
.. note::
|
||||||
|
This dataloader is used when the batch size is ``None``.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -84,8 +78,10 @@ class Collator:
|
|||||||
Initialize the object, setting the collate function based on whether
|
Initialize the object, setting the collate function based on whether
|
||||||
automatic batching is enabled or not.
|
automatic batching is enabled or not.
|
||||||
|
|
||||||
:param dict max_conditions_lengths: dict containing the maximum number
|
:param dict max_conditions_lengths: ``dict`` containing the maximum
|
||||||
of data points to consider in a single batch for each condition.
|
number of data points to consider in a single batch for
|
||||||
|
each condition.
|
||||||
|
:param bool automatic_batching: Whether to enable automatic batching.
|
||||||
:param PinaDataset dataset: The dataset where the data is stored.
|
:param PinaDataset dataset: The dataset where the data is stored.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@@ -276,7 +276,8 @@ class PinaGraphDataset(PinaDataset):
|
|||||||
:param data: List of items to collate in a single batch.
|
:param data: List of items to collate in a single batch.
|
||||||
:type data: list[Data] | list[Graph]
|
:type data: list[Data] | list[Graph]
|
||||||
:return: Batch object.
|
:return: Batch object.
|
||||||
:rtype: Batch | LabelBatch
|
:rtype: :class:`~torch_geometric.data.Batch`
|
||||||
|
| :class:`~pina.graph.LabelBatch`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if isinstance(data[0], Data):
|
if isinstance(data[0], Data):
|
||||||
|
|||||||
@@ -399,8 +399,9 @@ class LabelBatch(Batch):
|
|||||||
:param data_list: List of :class:`~torch_geometric.data.Data` or
|
:param data_list: List of :class:`~torch_geometric.data.Data` or
|
||||||
:class:`~pina.graph.Graph` objects.
|
:class:`~pina.graph.Graph` objects.
|
||||||
:type data_list: list[Data] | list[Graph]
|
:type data_list: list[Data] | list[Graph]
|
||||||
:return: A :class:`Batch` object containing the input data.
|
:return: A :class:`~torch_geometric.data.Batch` object containing
|
||||||
:rtype: Batch
|
the input data.
|
||||||
|
:rtype: :class:`~torch_geometric.data.Batch`
|
||||||
"""
|
"""
|
||||||
# Store the labels of Data/Graph objects (all data have the same labels)
|
# Store the labels of Data/Graph objects (all data have the same labels)
|
||||||
# If the data do not contain labels, labels is an empty dictionary,
|
# If the data do not contain labels, labels is an empty dictionary,
|
||||||
|
|||||||
@@ -389,14 +389,15 @@ class LabelTensor(torch.Tensor):
|
|||||||
|
|
||||||
def requires_grad_(self, mode=True):
|
def requires_grad_(self, mode=True):
|
||||||
"""
|
"""
|
||||||
Override the requires_grad_ method to handle the labels in the new
|
Override the :meth:`~torch.Tensor.requires_grad_` method to handle
|
||||||
tensor. For more details, see :meth:`torch.Tensor.requires_grad_`.
|
the labels in the new tensor.
|
||||||
|
For more details, see :meth:`~torch.Tensor.requires_grad_`.
|
||||||
|
|
||||||
:param bool mode: A boolean value indicating whether the tensor should
|
:param bool mode: A boolean value indicating whether the tensor should
|
||||||
track gradients.If `True`, the tensor will track gradients;
|
track gradients.If `True`, the tensor will track gradients;
|
||||||
if `False`, it will not.
|
if `False`, it will not.
|
||||||
:return: The :class:`~pina.label_tensor.LabelTensor` itself with the
|
:return: The :class:`~pina.label_tensor.LabelTensor` itself with the
|
||||||
updated `requires_grad` state and retained labels.
|
updated ``requires_grad`` state and retained labels.
|
||||||
:rtype: LabelTensor
|
:rtype: LabelTensor
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ class BaseContinuousConv(torch.nn.Module, metaclass=ABCMeta):
|
|||||||
batch_size, :math:`N_{in}` is the number of input fields, :math:`N`
|
batch_size, :math:`N_{in}` is the number of input fields, :math:`N`
|
||||||
the number of points in the mesh, :math:`D` the dimension of the problem.
|
the number of points in the mesh, :math:`D` the dimension of the problem.
|
||||||
In particular:
|
In particular:
|
||||||
|
|
||||||
* :math:`D` is the number of spatial variables + 1. The last column must
|
* :math:`D` is the number of spatial variables + 1. The last column must
|
||||||
contain the field value.
|
contain the field value.
|
||||||
* :math:`N_{in}` represents the number of function components.
|
* :math:`N_{in}` represents the number of function components.
|
||||||
|
|||||||
@@ -15,10 +15,13 @@ class ContinuousConvBlock(BaseContinuousConv):
|
|||||||
batch_size, :math:`N_{in}` is the number of input fields, :math:`N`
|
batch_size, :math:`N_{in}` is the number of input fields, :math:`N`
|
||||||
the number of points in the mesh, :math:`D` the dimension of the problem.
|
the number of points in the mesh, :math:`D` the dimension of the problem.
|
||||||
In particular:
|
In particular:
|
||||||
|
|
||||||
* :math:`D` is the number of spatial variables + 1. The last column must
|
* :math:`D` is the number of spatial variables + 1. The last column must
|
||||||
contain the field value.
|
contain the field value. For example for 2D problems :math:`D=3` and
|
||||||
* :math:`N_{in}` represents the number of function components.
|
the tensor will be something like ``[first coordinate, second
|
||||||
For instance, a vectorial function :math:`f = [f_1, f_2]` has
|
coordinate, field value]``.
|
||||||
|
* :math:`N_{in}` represents the number of vectorial function presented.
|
||||||
|
For example a vectorial function :math:`f = [f_1, f_2]` will have
|
||||||
:math:`N_{in}=2`.
|
:math:`N_{in}=2`.
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|||||||
@@ -412,6 +412,7 @@ class DeepONet(MIONet):
|
|||||||
Differently, for a :class:`torch.Tensor` only a list of integers can
|
Differently, for a :class:`torch.Tensor` only a list of integers can
|
||||||
be passed for ``input_indeces_branch_net`` and
|
be passed for ``input_indeces_branch_net`` and
|
||||||
``input_indeces_trunk_net``.
|
``input_indeces_trunk_net``.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
No checks are performed in the forward pass to verify if the input
|
No checks are performed in the forward pass to verify if the input
|
||||||
is instance of either :class:`~pina.label_tensor.LabelTensor` or
|
is instance of either :class:`~pina.label_tensor.LabelTensor` or
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class FeedForward(torch.nn.Module):
|
|||||||
:param int inner_size: The number of neurons for each hidden layer.
|
:param int inner_size: The number of neurons for each hidden layer.
|
||||||
Default is ``20``.
|
Default is ``20``.
|
||||||
:param int n_layers: The number of hidden layers. Default is ``2``.
|
:param int n_layers: The number of hidden layers. Default is ``2``.
|
||||||
::param func: The activation function. If a list is passed, it must have
|
:param func: The activation function. If a list is passed, it must have
|
||||||
the same length as ``n_layers``. If a single function is passed, it
|
the same length as ``n_layers``. If a single function is passed, it
|
||||||
is used for all layers, except for the last one.
|
is used for all layers, except for the last one.
|
||||||
Default is :class:`torch.nn.Tanh`.
|
Default is :class:`torch.nn.Tanh`.
|
||||||
@@ -144,7 +144,7 @@ class ResidualFeedForward(torch.nn.Module):
|
|||||||
:param int inner_size: The number of neurons for each hidden layer.
|
:param int inner_size: The number of neurons for each hidden layer.
|
||||||
Default is ``20``.
|
Default is ``20``.
|
||||||
:param int n_layers: The number of hidden layers. Default is ``2``.
|
:param int n_layers: The number of hidden layers. Default is ``2``.
|
||||||
::param func: The activation function. If a list is passed, it must have
|
:param func: The activation function. If a list is passed, it must have
|
||||||
the same length as ``n_layers``. If a single function is passed, it
|
the same length as ``n_layers``. If a single function is passed, it
|
||||||
is used for all layers, except for the last one.
|
is used for all layers, except for the last one.
|
||||||
Default is :class:`torch.nn.Tanh`.
|
Default is :class:`torch.nn.Tanh`.
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ class FNO(KernelNeuralOperator):
|
|||||||
layers=None,
|
layers=None,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
param torch.nn.Module lifting_net: The lifting neural network mapping
|
:param torch.nn.Module lifting_net: The lifting neural network mapping
|
||||||
the input to its hidden dimension.
|
the input to its hidden dimension.
|
||||||
:param torch.nn.Module projecting_net: The projection neural network
|
:param torch.nn.Module projecting_net: The projection neural network
|
||||||
mapping the hidden representation to the output function.
|
mapping the hidden representation to the output function.
|
||||||
@@ -325,12 +325,14 @@ class FNO(KernelNeuralOperator):
|
|||||||
``projection_net`` maps the hidden representation to the output
|
``projection_net`` maps the hidden representation to the output
|
||||||
function.
|
function.
|
||||||
|
|
||||||
: param x: The input tensor for performing the computation. Depending
|
:param x: The input tensor for performing the computation. Depending
|
||||||
on the ``dimensions`` in the initialization, it expects a tensor
|
on the ``dimensions`` in the initialization, it expects a tensor
|
||||||
with the following shapes:
|
with the following shapes:
|
||||||
|
|
||||||
* 1D tensors: ``[batch, X, channels]``
|
* 1D tensors: ``[batch, X, channels]``
|
||||||
* 2D tensors: ``[batch, X, Y, channels]``
|
* 2D tensors: ``[batch, X, Y, channels]``
|
||||||
* 3D tensors: ``[batch, X, Y, Z, channels]``
|
* 3D tensors: ``[batch, X, Y, Z, channels]``
|
||||||
|
|
||||||
:type x: torch.Tensor | LabelTensor
|
:type x: torch.Tensor | LabelTensor
|
||||||
:return: The output tensor.
|
:return: The output tensor.
|
||||||
:rtype: torch.Tensor
|
:rtype: torch.Tensor
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ from .kernel_neural_operator import KernelNeuralOperator
|
|||||||
|
|
||||||
class GraphNeuralKernel(torch.nn.Module):
|
class GraphNeuralKernel(torch.nn.Module):
|
||||||
"""
|
"""
|
||||||
Graph Neural Kernel model class.
|
Graph Neural Operator kernel model class.
|
||||||
|
|
||||||
This class implements the Graph Neural Kernel network.
|
This class implements the Graph Neural Operator kernel network.
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
@@ -18,8 +18,7 @@ class GraphNeuralKernel(torch.nn.Module):
|
|||||||
Liu, B., Bhattacharya, K., Stuart, A., Anandkumar, A. (2020).
|
Liu, B., Bhattacharya, K., Stuart, A., Anandkumar, A. (2020).
|
||||||
*Neural Operator: Graph Kernel Network for Partial Differential
|
*Neural Operator: Graph Kernel Network for Partial Differential
|
||||||
Equations*.
|
Equations*.
|
||||||
DOI: `arXiv preprint arXiv:2003.03485.
|
DOI: `arXiv preprint arXiv:2003.03485 <https://arxiv.org/abs/2003.03485>`_
|
||||||
<https://arxiv.org/abs/2003.03485>`_
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
@@ -171,7 +170,7 @@ class GraphNeuralOperator(KernelNeuralOperator):
|
|||||||
"""
|
"""
|
||||||
Initialization of the :class:`GraphNeuralOperator` class.
|
Initialization of the :class:`GraphNeuralOperator` class.
|
||||||
|
|
||||||
param torch.nn.Module lifting_operator: The lifting neural network
|
:param torch.nn.Module lifting_operator: The lifting neural network
|
||||||
mapping the input to its hidden dimension.
|
mapping the input to its hidden dimension.
|
||||||
:param torch.nn.Module projection_operator: The projection neural
|
:param torch.nn.Module projection_operator: The projection neural
|
||||||
network mapping the hidden representation to the output function.
|
network mapping the hidden representation to the output function.
|
||||||
|
|||||||
@@ -17,8 +17,9 @@ class TorchOptimizer(Optimizer):
|
|||||||
|
|
||||||
:param torch.optim.Optimizer optimizer_class: A
|
:param torch.optim.Optimizer optimizer_class: A
|
||||||
:class:`torch.optim.Optimizer` class.
|
:class:`torch.optim.Optimizer` class.
|
||||||
:param dict kwargs: Additional parameters passed to `optimizer_class`,
|
:param dict kwargs: Additional parameters passed to ``optimizer_class``,
|
||||||
see more: <https://pytorch.org/docs/stable/optim.html#algorithms>_.
|
see more
|
||||||
|
`here <https://pytorch.org/docs/stable/optim.html#algorithms>`_.
|
||||||
"""
|
"""
|
||||||
check_consistency(optimizer_class, torch.optim.Optimizer, subclass=True)
|
check_consistency(optimizer_class, torch.optim.Optimizer, subclass=True)
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,9 @@ class TorchScheduler(Scheduler):
|
|||||||
|
|
||||||
:param torch.optim.LRScheduler scheduler_class: A
|
:param torch.optim.LRScheduler scheduler_class: A
|
||||||
:class:`torch.optim.LRScheduler` class.
|
:class:`torch.optim.LRScheduler` class.
|
||||||
:param dict kwargs: Additional parameters passed to `scheduler_class`,
|
:param dict kwargs: Additional parameters passed to ``scheduler_class``,
|
||||||
see more: <https://pytorch.org/docs/stable/optim.html#algorithms>_.
|
see more
|
||||||
|
`here <https://pytorch.org/docs/stable/optim.html#algorithms>_`.
|
||||||
"""
|
"""
|
||||||
check_consistency(scheduler_class, LRScheduler, subclass=True)
|
check_consistency(scheduler_class, LRScheduler, subclass=True)
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class AbstractProblem(metaclass=ABCMeta):
|
|||||||
Get batching dimension.
|
Get batching dimension.
|
||||||
|
|
||||||
:return: The batching dimension.
|
:return: The batching dimension.
|
||||||
:rtype int
|
:rtype: int
|
||||||
"""
|
"""
|
||||||
return self._batching_dimension
|
return self._batching_dimension
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ class AbstractProblem(metaclass=ABCMeta):
|
|||||||
points.
|
points.
|
||||||
|
|
||||||
:return: The discretised domains.
|
:return: The discretised domains.
|
||||||
:rtype dict
|
:rtype: dict
|
||||||
"""
|
"""
|
||||||
return self._discretised_domains
|
return self._discretised_domains
|
||||||
|
|
||||||
@@ -178,13 +178,28 @@ class AbstractProblem(metaclass=ABCMeta):
|
|||||||
chebyshev sampling, ``chebyshev``; grid sampling ``grid``.
|
chebyshev sampling, ``chebyshev``; grid sampling ``grid``.
|
||||||
:param domains: The domains from which to sample. Default is ``all``.
|
:param domains: The domains from which to sample. Default is ``all``.
|
||||||
:type domains: str | list[str]
|
:type domains: str | list[str]
|
||||||
:param dict sample_rules: A dictionary of custom sampling rules.
|
:param dict sample_rules: A dictionary defining custom sampling rules
|
||||||
|
for input variables. If provided, it must contain a dictionary
|
||||||
|
specifying the sampling rule for each variable, overriding the
|
||||||
|
``n`` and ``mode`` arguments. Each key must correspond to the
|
||||||
|
input variables from
|
||||||
|
:meth:~pina.problem.AbstractProblem.input_variables, and its value
|
||||||
|
should be another dictionary with
|
||||||
|
two keys: ``n`` (number of points to sample) and ``mode``
|
||||||
|
(sampling method). Defaults to None.
|
||||||
:raises RuntimeError: If both ``n`` and ``sample_rules`` are specified.
|
:raises RuntimeError: If both ``n`` and ``sample_rules`` are specified.
|
||||||
:raises RuntimeError: If neither ``n`` nor ``sample_rules`` are set.
|
:raises RuntimeError: If neither ``n`` nor ``sample_rules`` are set.
|
||||||
|
|
||||||
:Example:
|
:Example:
|
||||||
>>> problem.discretise_domain(n=10, mode='grid')
|
>>> problem.discretise_domain(n=10, mode='grid')
|
||||||
>>> problem.discretise_domain(n=10, mode='grid', domains=['gamma1'])
|
>>> problem.discretise_domain(n=10, mode='grid', domains=['gamma1'])
|
||||||
|
>>> problem.discretise_domain(
|
||||||
|
... sample_rules={
|
||||||
|
... 'x': {'n': 10, 'mode': 'grid'},
|
||||||
|
... 'y': {'n': 100, 'mode': 'grid'}
|
||||||
|
... },
|
||||||
|
... domains=['D']
|
||||||
|
... )
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
``random`` is currently the only implemented ``mode`` for all
|
``random`` is currently the only implemented ``mode`` for all
|
||||||
@@ -197,6 +212,11 @@ class AbstractProblem(metaclass=ABCMeta):
|
|||||||
:class:`~pina.domain.intersection_domain.Intersection`.
|
:class:`~pina.domain.intersection_domain.Intersection`.
|
||||||
The modes ``latin`` or ``lh``, ``chebyshev``, ``grid`` are only
|
The modes ``latin`` or ``lh``, ``chebyshev``, ``grid`` are only
|
||||||
implemented for :class:`~pina.domain.cartesian.CartesianDomain`.
|
implemented for :class:`~pina.domain.cartesian.CartesianDomain`.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
If custom discretisation is applied by setting ``sample_rules`` not
|
||||||
|
to ``None``, then the discretised domain must be of class
|
||||||
|
:class:`~pina.domain.cartesian.CartesianDomain`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# check consistecy n, mode, variables, locations
|
# check consistecy n, mode, variables, locations
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class RBAPINN(PINN):
|
|||||||
|
|
||||||
:param AbstractProblem problem: The problem to be solved.
|
:param AbstractProblem problem: The problem to be solved.
|
||||||
:param torch.nn.Module model: The neural network model to be used.
|
:param torch.nn.Module model: The neural network model to be used.
|
||||||
param Optimizer optimizer: The optimizer to be used.
|
:param Optimizer optimizer: The optimizer to be used.
|
||||||
If `None`, the :class:`torch.optim.Adam` optimizer is used.
|
If `None`, the :class:`torch.optim.Adam` optimizer is used.
|
||||||
Default is ``None``.
|
Default is ``None``.
|
||||||
:param Scheduler scheduler: Learning rate scheduler.
|
:param Scheduler scheduler: Learning rate scheduler.
|
||||||
|
|||||||
@@ -13,8 +13,9 @@ class Trainer(lightning.pytorch.Trainer):
|
|||||||
PINA custom Trainer class to extend the standard Lightning functionality.
|
PINA custom Trainer class to extend the standard Lightning functionality.
|
||||||
|
|
||||||
This class enables specific features or behaviors required by the PINA
|
This class enables specific features or behaviors required by the PINA
|
||||||
framework. It modifies the standard :class:`lightning.pytorch.Trainer` class
|
framework. It modifies the standard
|
||||||
to better support the training process in PINA.
|
:class:`lightning.pytorch.Trainer <lightning.pytorch.trainer.trainer.Trainer>`
|
||||||
|
class to better support the training process in PINA.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
@@ -207,7 +208,9 @@ class Trainer(lightning.pytorch.Trainer):
|
|||||||
"""
|
"""
|
||||||
Manage the training process of the solver.
|
Manage the training process of the solver.
|
||||||
|
|
||||||
:param dict kwargs: Additional keyword arguments.
|
:param dict kwargs: Additional keyword arguments. See `pytorch-lightning
|
||||||
|
Trainer API <https://lightning.ai/docs/pytorch/stable/common/trainer.html#trainer-class-api>`_
|
||||||
|
for details.
|
||||||
"""
|
"""
|
||||||
return super().fit(self.solver, datamodule=self.data_module, **kwargs)
|
return super().fit(self.solver, datamodule=self.data_module, **kwargs)
|
||||||
|
|
||||||
@@ -215,7 +218,9 @@ class Trainer(lightning.pytorch.Trainer):
|
|||||||
"""
|
"""
|
||||||
Manage the test process of the solver.
|
Manage the test process of the solver.
|
||||||
|
|
||||||
:param dict kwargs: Additional keyword arguments.
|
:param dict kwargs: Additional keyword arguments. See `pytorch-lightning
|
||||||
|
Trainer API <https://lightning.ai/docs/pytorch/stable/common/trainer.html#trainer-class-api>`_
|
||||||
|
for details.
|
||||||
"""
|
"""
|
||||||
return super().test(self.solver, datamodule=self.data_module, **kwargs)
|
return super().test(self.solver, datamodule=self.data_module, **kwargs)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user