Skip to content

Commit

Permalink
[Fix] Export available engines for qd+ (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmheim authored Dec 12, 2023
1 parent 9a027ff commit c64ed02
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ authors = [
]
requires-python = ">=3.9,<3.12"
license = {text = "Apache 2.0"}
version = "1.2.1"
version = "1.2.2"
classifiers=[
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
Expand Down
1 change: 1 addition & 0 deletions qadence/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def _set_backend_config(backend: Backend, diff_mode: DiffMode) -> None:
try:
module = importlib.import_module("qadence_extensions.extensions")
available_backends = getattr(module, "available_backends")
available_engines = getattr(module, "available_engines")
supported_gates = getattr(module, "supported_gates")
get_gpsr_fns = getattr(module, "gpsr_fns")
set_backend_config = getattr(module, "set_backend_config")
Expand Down
12 changes: 7 additions & 5 deletions qadence/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,22 @@ class _BackendName(StrEnum):
"""The horqrux backend."""


class _Engine(StrEnum):
TORCH = "torch"
JAX = "jax"


# If proprietary qadence_extensions is available, import the
# right function since more backends are supported.
try:
module = importlib.import_module("qadence_extensions.types")
BackendName = getattr(module, "BackendName")
DiffMode = getattr(module, "DiffMode")
Engine = getattr(module, "Engine")
except ModuleNotFoundError:
BackendName = _BackendName
DiffMode = _DiffMode
Engine = _Engine


class StateGeneratorType(StrEnum):
Expand Down Expand Up @@ -391,10 +398,5 @@ class ReadOutOptimization(StrEnum):
CONSTRAINED = "constrained"


class Engine(StrEnum):
TORCH = "torch"
JAX = "jax"


ParamDictType = dict[str, ArrayLike]
DifferentiableExpression = Callable[..., ArrayLike]

0 comments on commit c64ed02

Please sign in to comment.