Skip to content

Commit

Permalink
Merge pull request #30 from lululxvi/master
Browse files Browse the repository at this point in the history
update to latest version
  • Loading branch information
Jerry-Jzy authored Jan 5, 2025
2 parents ec36347 + 7bcda4b commit 7034cbe
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ DeepXDE requires one of the following backend-specific dependencies to be instal

- TensorFlow 1.x: [TensorFlow](https://www.tensorflow.org)>=2.7.0
- TensorFlow 2.x: [TensorFlow](https://www.tensorflow.org)>=2.3.0, [TensorFlow Probability](https://www.tensorflow.org/probability)>=0.11.0
- PyTorch: [PyTorch](https://pytorch.org)>=1.9.0
- PyTorch: [PyTorch](https://pytorch.org)>=2.0.0
- JAX: [JAX](https://jax.readthedocs.io), [Flax](https://flax.readthedocs.io), [Optax](https://optax.readthedocs.io)
- PaddlePaddle: [PaddlePaddle](https://www.paddlepaddle.org.cn/en)>=2.6.0

Expand Down
4 changes: 2 additions & 2 deletions deepxde/backend/pytorch/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import torch


if Version(torch.__version__) < Version("1.9.0"):
raise RuntimeError("DeepXDE requires PyTorch>=1.9.0.")
if Version(torch.__version__) < Version("2.0.0"):
raise RuntimeError("DeepXDE requires PyTorch>=2.0.0.")

# To write device-agnostic (CPU or GPU) code, a common pattern is to first determine
# torch.device and then use it for all the tensors.
Expand Down
12 changes: 12 additions & 0 deletions deepxde/optimizers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
import importlib
import os
import sys

from .config import LBFGS_options, set_LBFGS_options, NNCG_options, set_NNCG_options
from ..backend import backend_name


# To get Sphinx documentation to build, we import all
if os.environ.get("READTHEDOCS") == "True":
# The backend should be tensorflow/tensorflow.compat.v1 to ensure backend.tf is not
# None.
from . import jax
from . import paddle
from . import pytorch
from . import tensorflow
from . import tensorflow_compat_v1


def _load_backend(mod_name):
mod = importlib.import_module(".%s" % mod_name, __name__)
thismod = sys.modules[__name__]
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ If you are looking for information on a specific function, class or method, this
modules/deepxde.nn.tensorflow
modules/deepxde.nn.tensorflow_compat_v1
modules/deepxde.optimizers
modules/deepxde.optimizers.pytorch
modules/deepxde.utils

Indices and tables
Expand Down
20 changes: 5 additions & 15 deletions docs/modules/deepxde.optimizers.pytorch.rst
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
deepxde.optimizers.pytorch package
==================================
deepxde.optimizers.pytorch
==========================

Submodules
----------
deepxde.optimizers.pytorch.nncg module
--------------------------------------

deepxde.optimizers.pytorch.optimizers module
--------------------------------------------

.. automodule:: deepxde.optimizers.pytorch.optimizers
.. automodule:: deepxde.optimizers.pytorch.nncg
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: deepxde.optimizers.pytorch
:members:
:undoc-members:
:show-inheritance:
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tensorflow>=2.7.0
# TensorFlow 2.x
tensorflow-probability>=0.11.0
# PyTorch
torch<2.0.0 # build fails on RTD with torch 2.0.0
torch
# PaddlePaddle
# https://paddle-wheel.bj.bcebos.com/develop/linux/linux-cpu-mkl-avx/paddlepaddle-0.0.0-cp38-cp38-linux_x86_64.whl
paddlepaddle==2.6.0
Expand Down
4 changes: 2 additions & 2 deletions docs/user/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ DeepXDE requires one of the following backend-specific dependencies to be instal

- For TensorFlow 2.16+ with Keras 3, refer to `the instruction <https://github.com/tensorflow/probability/releases/tag/v0.24.0>`_ for installing TensorFlow Probability.

- PyTorch: `PyTorch <https://pytorch.org>`_>=1.9.0
- PyTorch: `PyTorch <https://pytorch.org>`_>=2.0.0
- JAX: `JAX <https://jax.readthedocs.io>`_, `Flax <https://flax.readthedocs.io>`_, `Optax <https://optax.readthedocs.io>`_
- PaddlePaddle: `PaddlePaddle <https://www.paddlepaddle.org.cn/en>`_>=2.6.0

Expand Down Expand Up @@ -124,7 +124,7 @@ Export ``DDE_BACKEND`` as ``pytorch`` to specify PyTorch backend. In addition, i
.. code:: python
if torch.cuda.is_available():
torch.set_default_tensor_type(torch.cuda.FloatTensor)
torch.set_default_device("cuda")
JAX backend
```````````
Expand Down

0 comments on commit 7034cbe

Please sign in to comment.