Library / SDK
lululxvi/deepxde avatar
lululxvi/deepxde

DeepXDE puts the PDE on the loss function

A library for scientific machine learning and physics-informed learning

4,510 stars1,020 forksPythonLGPL-2.1

At a glance

What is it?
DeepXDE turns a differential equation into a training objective, so an inverse problem with fifty measurements becomes an optimization run rather than a meshing project. The payoff is real for physics-informed work; the cost is that your loss function is no longer a number you can check against anything.
Who is it for?
Adopt DeepXDE when the governing equation is known and the measurement count is small, which is the inverse problem PINNs were built for, and when you already work in one of its five backends. Do not adopt it when you need certified error bars, a mesh you can inspect, or a solution you can grid-check against a reference solver, because a falling loss is the only referee in the loop.
Can I use it commercially?
Yes, with conditions. LGPL-2.1 is a weak copyleft licence: you can use it inside commercial and closed-source software, but if you distribute changes to its own files, you must publish those changes under the same licence.
Is it still maintained?
Yes. The repository last received commits 6 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 22, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • lululxvi/deepxde4,510 ★ · +90
Star history
Repository2026-09-112026-11-22
lululxvi/deepxde4.4k4.5k

90 Stars in the last 72 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The equation becomes the loss, not the input

Most solvers want your equation in a form they can discretize. DeepXDE wants it in a form they can differentiate. You write the PDE as a Python function, hand it to the library, and the library takes automatic derivatives of that function with respect to the inputs, then compares the result to zero at a batch of sampled points. The residual, not the data, is what the optimizer descends.

That inversion matters for a specific reader: someone with a handful of measurements and a governing equation they trust. DeepXDE covers both forward and inverse problems, and its example tree separates those cases cleanly, with directories for `pinn_forward/`, `pinn_inverse/`, `operator/`, `function/`, and `dataset/`, plus a top-level `sample_to_test.py`.

The scope is wider than PINNs. DeepONet, MIONet, Fourier-DeepONet, multifidelity DeepONet, and DeepM&Mnet for multiphysics sit in the same package, and the README notes that all components are loosely coupled.

Five backends means five failure modes before you write a line of physics

DeepXDE runs on TensorFlow 1.x (through `tensorflow.compat.v1` under TensorFlow 2.x), TensorFlow 2.x, PyTorch, JAX, and PaddlePaddle. The backend is not an abstraction layer you set once and forget. Each one has its own floor, and the pins are specific: PyTorch>=2.0.0, PaddlePaddle>=2.6.0, TensorFlow>=2.7.0 for the 1.x path, TensorFlow>=2.3.0 plus TensorFlow Probability>=0.11.0 for the 2.x path, and JAX with Flax and Optax.

Pick the backend your existing code already uses. DeepXDE adds matplotlib, numpy, scikit-learn, scikit-optimize>=0.10.2, and scipy on top, and `pyproject.toml` sets `requires-python = ">=3.9"` with classifiers for 3.9 through 3.12. Nothing here is exotic. The interesting detail is that the TensorFlow 1.x path is not a separate package: it runs through `tensorflow.compat.v1` in TensorFlow 2.x.

pip, conda, or a clone next to your scripts

Install the backend dependency first, then the library. The stable version comes from pip:

sh
$ pip install deepxde

The conda route pulls the same package from the conda-forge channel:

sh
$ conda install -c conda-forge deepxde

Developers are told to clone the folder and place it alongside their own scripts rather than installing from PyPI:

sh
$ git clone https://github.com/lululxvi/deepxde.git

Cloning is the option that matters if you plan to read the source. The package declares `write_to = "deepxde/_version.py"` under setuptools_scm and sets its version dynamically. Note what the dependency list does not include: no backend. TensorFlow, PyTorch, JAX, or PaddlePaddle is your responsibility. The package also ships a `docker/` directory that setuptools excludes from the wheel.

Hard constraints and CSG, the two things a grid solver makes you do by hand

Two features do work that classical codes push back onto the user. The first is hard constraints. Instead of penalizing a boundary mismatch in the loss, DeepXDE can build the boundary condition into the network output, so it is satisfied by construction. Approximate distance functions supply the geometry those constraints need. The five boundary types are Dirichlet, Neumann, Robin, periodic, and a general one definable on an arbitrary domain or on a bare point set.

The second is geometry. Primitive shapes cover interval, triangle, rectangle, polygon, disk, ellipse, star-shaped, cuboid, sphere, hypercube, and hypersphere. Anything else is assembled by constructive solid geometry from exactly three boolean operations: union, difference, intersection. A point cloud works too. The phrase in the README about avoiding the tyranny of mesh generation is doing real work here, because for a fluid domain described by two subtracted bodies, CSG removes the mesh-generation step entirely.

Neither feature is free. Hard constraints change what the loss sees, so a run that does not converge may be a bad constraint rather than a bad optimizer, and diagnosing that means reading the forward pass.

Where the residual and the data disagree, the loss is the only referee

The genuine failure mode is a loss that drops while the answer stays wrong. A PINN minimizes a weighted sum of the PDE residual over collocation points plus the mismatch at data points. Shrink that sum and you can shrink it by sampling where the residual is easy rather than where the equation is hard. That is the whole reason residual-based adaptive sampling exists in the library, and why uniform, pseudorandom, Latin hypercube, Halton, Hammersley, and Sobol sampling are all exposed: the sampling strategy is a hyperparameter you can be wrong about.

Three AD methods, reverse mode, forward mode, and zero coordinate shift, feed that residual. Adam and L-BFGS are both available, and pairing a global optimizer with an adaptive sampler is where the tuning cost concentrates. Dropout-based uncertainty quantification is offered, but the README gives no coverage guarantee attached to it, so treat it as a diagnostic rather than a bound.

There is a smaller trap: float16, float32, and float64 are all selectable.

DeepONet and MFNN solve a different problem than a PINN

Most of the algorithm surface is not PINN. DeepONet learns an operator between function spaces rather than the solution of one equation, and the extension list runs to POD-DeepONet, MIONet for multiple inputs, Fourier-DeepONet and Fourier-MIONet, physics-informed DeepONet, multifidelity DeepONet, and DeepM&Mnet for coupled multiphysics. MFNN sits alongside it for learning from data at several fidelity levels, where cheap low-fidelity runs inform an expensive high-fidelity model.

The honest alternative is to write the operator network yourself in your framework of choice. The difference in approach is that DeepXDE supplies the four function spaces (power series, Chebyshev polynomial, Gaussian random field in 1D and 2D), the callbacks for early stopping, the model save and load path, and data-parallel training over multiple GPUs. Rolling your own means reimplementing the part that takes the most code and produces the least novelty. What you give up is the shared API, and with it the ability to move a PINN and an operator model between the same test harness.

A second comparison, to PyTorch itself, is a category error rather than an alternative: DeepXDE requires PyTorch>=2.0.0 as one of five possible backends and adds the physics layer on top.

Loose coupling is the design and the risk at the same time

Every part of DeepXDE is described as loosely coupled and highly configurable, and the repository layout backs that up: a `deepxde/` package, an `examples/` tree, `docs/` for the ReadTheDocs build, and a `docker/` directory excluded from packaging. The package is licensed LGPL-2.1 and the last push landed on 2026-11-02, the same day v1.15.1 shipped.

Loose coupling cuts both ways. Callbacks, custom networks, and custom samplers plug in without patching the library, which is the right structure for research code that will be rewritten. It also means there is no single opinionated path for, say, checkpoint scheduling or loss balancing, so reproducibility depends on your own config being recorded.

Editorial conclusion

Adopt DeepXDE when the governing equation is known and the measurement count is small, which is the inverse problem PINNs were built for, and when you already work in one of its five backends. Do not adopt it when you need certified error bars, a mesh you can inspect, or a solution you can grid-check against a reference solver, because a falling loss is the only referee in the loop. Verify two things before writing physics code: that your installed backend clears the floor listed for it, and that your first run reproduces the loss curve of an unmodified example from examples/pinn_forward before you swap in your own residual.

Frequently asked questions

how to install deepxde

Install a backend first, then the library: PyTorch>=2.0.0, TensorFlow>=2.3.0, JAX with Flax and Optax, or PaddlePaddle>=2.6.0. Then run pip install deepxde or conda install -c conda-forge deepxde. Python 3.9 or newer is required.

what is deepxde

DeepXDE is a Python library for scientific machine learning and physics-informed learning. It implements PINNs, DeepONet and its extensions, and multifidelity neural networks, and it runs on TensorFlow 1.x, TensorFlow 2.x, PyTorch, JAX, and PaddlePaddle.

how to use deepxde

Write the governing equation as a Python function so the library can differentiate it, then train with a loss built from that residual. The examples directory splits usage into function, dataset, operator, pinn_forward, and pinn_inverse cases.

deepxde vs pytorch

PyTorch is one of five possible backends for DeepXDE and is not a competitor to it. DeepXDE adds the physics-informed layer: automatic differentiation of the PDE residual, boundary conditions including hard constraints, sampling strategies, and operator networks.

Official sources

  1. License: LGPL-2.1
  2. lululxvi/deepxde on GitHub
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/lululxvi-deepxde.svg)](https://hysenlabs.com/projects/lululxvi-deepxde)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/lululxvi-deepxde.svg)](https://hysenlabs.com/projects/lululxvi-deepxde)

Was this useful?