Welcome to PINAโs documentation!#
Designed with composable abstractions โ plug, replace, or extend components freely.
Native multi-device training with minimal overhead for large-scale problems.
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.
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()
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)),
}
# Step 1. Define problem
problem = SimpleODE()
problem.discretise_domain(n=100, mode="grid", domains=["D", "x0"])
# Step 2. Define model
model = FeedForward(input_dimensions=1, output_dimensions=1, layers=[64, 64])
# Step 3. Define solver
solver = PhysicsInformedSingleModelSolver(problem, model)
# Step 4. Train
trainer = Trainer(solver, max_epochs=1000, accelerator="gpu")
trainer.train()
Whatโs New
[v0.3] โ New solvers: autoregressive solver for sequential prediction tasks and multi-model solver support. Internals redesigned around a mixin architecture โ lightweight, single-responsibility mixins (preprocessing, forward, postprocessing) that can be freely composed, with residual computation and loss aggregation clearly separated.
[v0.3] โ Conditions refactoring: evaluation logic moved out of the solver and into the condition itself via a dedicated evaluate method, decoupling the training loop from problem-specific logic and enabling fully modular, solver-agnostic conditions.
[v0.3] โ Time-dependent conditions: added dedicated time series and graph time series conditions to support time-dependent problems and autoregressive formulations across sequential and graph-structured data.
[v0.3] โ Code cleanup: core internals migrated to the _src pattern; interfaces and base classes introduced across conditions, problems (AbstractProblem โ BaseProblem), losses, and data module; equation zoo reorganized with Burgers added.
[v0.3] โ KAN support: KolmogorovโArnold Networks with fully vectorized spline basis and analytical derivatives.
Install PINA via pip, from source, or with extras.
Get up and running in 5 minutes.
Complete API docs for problems, solvers, models, and more.
Step-by-step tutorials covering PINNs, Neural Operators, and more.
Citation and BibTeX for academic use.
Guide for contributors, bug reports, and PRs.
Meet the PINA team and our funding sources.
Open-source license information.