INNER CODE UNIT · Python

get_preferred_backend

lululxvi/deepxde · deepxde/backend/__init__.py:96

def get_preferred_backend():
    backend_name = None
    # User-selected backend
    config_path = os.path.join(os.path.expanduser("~"), ".deepxde", "config.json")
    if "DDE_BACKEND" in os.environ:
        backend_name = os.getenv("DDE_BACKEND")
    # Backward compatibility
    elif "DDEBACKEND" in os.environ:
        backend_name = os.getenv("DDEBACKEND")
    elif os.path.exists(config_path):
        with open(config_path, "r") as config_file:
            config_dict = json.load(config_file)
            backend_name = config_dict.get("backend", "").lower()
    if backend_name is not None:
        verify_backend(backend_name)
        return backend_name
    # No backend selected
    print("No backend selected.", file=sys.stderr, flush=True)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…