diff --git a/deepxde/optimizers/__init__.py b/deepxde/optimizers/__init__.py index 556761a86..2f669ae76 100644 --- a/deepxde/optimizers/__init__.py +++ b/deepxde/optimizers/__init__.py @@ -5,6 +5,17 @@ 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__]