qadence 1.4.1__py3-none-any.whl → 1.5.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qadence/__init__.py +1 -0
- qadence/backend.py +1 -26
- qadence/backends/braket/backend.py +1 -1
- qadence/backends/horqrux/backend.py +1 -1
- qadence/backends/pulser/backend.py +1 -1
- qadence/backends/pyqtorch/backend.py +26 -23
- qadence/backends/pyqtorch/convert_ops.py +25 -10
- qadence/backends/utils.py +3 -2
- qadence/engines/torch/differentiable_expectation.py +4 -164
- qadence/libs.py +15 -0
- qadence/ml_tools/data.py +11 -11
- qadence/ml_tools/models.py +21 -9
- qadence/ml_tools/optimize_step.py +2 -1
- qadence/ml_tools/train_grad.py +19 -8
- qadence/models/quantum_model.py +17 -9
- {qadence-1.4.1.dist-info → qadence-1.5.1.dist-info}/METADATA +10 -5
- {qadence-1.4.1.dist-info → qadence-1.5.1.dist-info}/RECORD +19 -18
- {qadence-1.4.1.dist-info → qadence-1.5.1.dist-info}/WHEEL +1 -1
- {qadence-1.4.1.dist-info → qadence-1.5.1.dist-info}/licenses/LICENSE +0 -0
    
        qadence/__init__.py
    CHANGED
    
    | @@ -32,6 +32,7 @@ DEFAULT_FLOAT_DTYPE = torchfloat64 | |
| 32 32 | 
             
            DEFAULT_COMPLEX_DTYPE = cdouble
         | 
| 33 33 | 
             
            set_default_dtype(DEFAULT_FLOAT_DTYPE)
         | 
| 34 34 |  | 
| 35 | 
            +
             | 
| 35 36 | 
             
            """Fetch the functions defined in the __all__ of each sub-module.
         | 
| 36 37 |  | 
| 37 38 | 
             
            Import to the qadence name space. Make sure each added submodule has the respective definition:
         | 
    
        qadence/backend.py
    CHANGED
    
    | @@ -26,7 +26,6 @@ from qadence.mitigations import Mitigations | |
| 26 26 | 
             
            from qadence.noise import Noise
         | 
| 27 27 | 
             
            from qadence.parameters import stringify
         | 
| 28 28 | 
             
            from qadence.types import ArrayLike, BackendName, DiffMode, Endianness, Engine, ParamDictType
         | 
| 29 | 
            -
            from qadence.utils import validate_values_and_state
         | 
| 30 29 |  | 
| 31 30 | 
             
            logger = get_logger(__file__)
         | 
| 32 31 |  | 
| @@ -259,29 +258,6 @@ class Backend(ABC): | |
| 259 258 | 
             
                    """
         | 
| 260 259 | 
             
                    raise NotImplementedError
         | 
| 261 260 |  | 
| 262 | 
            -
                @abstractmethod
         | 
| 263 | 
            -
                def _run(
         | 
| 264 | 
            -
                    self,
         | 
| 265 | 
            -
                    circuit: ConvertedCircuit,
         | 
| 266 | 
            -
                    param_values: dict[str, ArrayLike] = {},
         | 
| 267 | 
            -
                    state: ArrayLike | None = None,
         | 
| 268 | 
            -
                    endianness: Endianness = Endianness.BIG,
         | 
| 269 | 
            -
                ) -> ArrayLike:
         | 
| 270 | 
            -
                    """Run a circuit and return the resulting wave function.
         | 
| 271 | 
            -
             | 
| 272 | 
            -
                    Arguments:
         | 
| 273 | 
            -
                        circuit: A converted circuit as returned by `backend.circuit`.
         | 
| 274 | 
            -
                        param_values: _**Already embedded**_ parameters of the circuit. See
         | 
| 275 | 
            -
                            [`embedding`][qadence.blocks.embedding.embedding] for more info.
         | 
| 276 | 
            -
                        state: Initial state.
         | 
| 277 | 
            -
                        endianness: Endianness of the resulting wavefunction.
         | 
| 278 | 
            -
             | 
| 279 | 
            -
                    Returns:
         | 
| 280 | 
            -
                        A list of Counter objects where each key represents a bitstring
         | 
| 281 | 
            -
                        and its value the number of times it has been sampled from the given wave function.
         | 
| 282 | 
            -
                    """
         | 
| 283 | 
            -
                    raise NotImplementedError
         | 
| 284 | 
            -
             | 
| 285 261 | 
             
                def run(
         | 
| 286 262 | 
             
                    self,
         | 
| 287 263 | 
             
                    circuit: ConvertedCircuit,
         | 
| @@ -304,8 +280,7 @@ class Backend(ABC): | |
| 304 280 | 
             
                        A list of Counter objects where each key represents a bitstring
         | 
| 305 281 | 
             
                        and its value the number of times it has been sampled from the given wave function.
         | 
| 306 282 | 
             
                    """
         | 
| 307 | 
            -
                     | 
| 308 | 
            -
                    return self._run(circuit, param_values, state, endianness, *args, **kwargs)
         | 
| 283 | 
            +
                    raise NotImplementedError
         | 
| 309 284 |  | 
| 310 285 | 
             
                @abstractmethod
         | 
| 311 286 | 
             
                def run_dm(
         | 
| @@ -66,7 +66,7 @@ class Backend(BackendInterface): | |
| 66 66 | 
             
                    hq_obs = convert_observable(block, n_qubits=n_qubits, config=self.config)
         | 
| 67 67 | 
             
                    return ConvertedObservable(native=hq_obs, abstract=block, original=observable)
         | 
| 68 68 |  | 
| 69 | 
            -
                def  | 
| 69 | 
            +
                def run(
         | 
| 70 70 | 
             
                    self,
         | 
| 71 71 | 
             
                    circuit: ConvertedCircuit,
         | 
| 72 72 | 
             
                    param_values: ParamDictType = {},
         | 
| @@ -80,7 +80,7 @@ class Backend(BackendInterface): | |
| 80 80 | 
             
                    (native,) = convert_observable(block, n_qubits=n_qubits, config=self.config)
         | 
| 81 81 | 
             
                    return ConvertedObservable(native=native, abstract=block, original=observable)
         | 
| 82 82 |  | 
| 83 | 
            -
                def  | 
| 83 | 
            +
                def run(
         | 
| 84 84 | 
             
                    self,
         | 
| 85 85 | 
             
                    circuit: ConvertedCircuit,
         | 
| 86 86 | 
             
                    param_values: dict[str, Tensor] = {},
         | 
| @@ -151,7 +151,9 @@ class Backend(BackendInterface): | |
| 151 151 | 
             
                    if state is None:
         | 
| 152 152 | 
             
                        from qadence.states import zero_state
         | 
| 153 153 |  | 
| 154 | 
            -
                        state = zero_state(circuit.abstract.n_qubits, batch_size=1)
         | 
| 154 | 
            +
                        state = zero_state(circuit.abstract.n_qubits, batch_size=1).to(
         | 
| 155 | 
            +
                            dtype=circuit.native.dtype
         | 
| 156 | 
            +
                        )
         | 
| 155 157 | 
             
                    if state.size(0) != 1:
         | 
| 156 158 | 
             
                        raise ValueError(
         | 
| 157 159 | 
             
                            "Looping expectation does not make sense with batched initial state. "
         | 
| @@ -222,28 +224,29 @@ class Backend(BackendInterface): | |
| 222 224 | 
             
                            }
         | 
| 223 225 | 
             
                        )
         | 
| 224 226 |  | 
| 225 | 
            -
                     | 
| 226 | 
            -
             | 
| 227 | 
            -
             | 
| 228 | 
            -
                         | 
| 229 | 
            -
                             | 
| 230 | 
            -
                                _probs | 
| 231 | 
            -
             | 
| 232 | 
            -
             | 
| 233 | 
            -
             | 
| 234 | 
            -
             | 
| 235 | 
            -
             | 
| 236 | 
            -
             | 
| 237 | 
            -
             | 
| 238 | 
            -
                    if noise is not None:
         | 
| 239 | 
            -
                        samples = apply_noise(noise=noise, samples=samples)
         | 
| 240 | 
            -
                    if mitigation is not None:
         | 
| 241 | 
            -
                        logger.warning(
         | 
| 242 | 
            -
                            "Mitigation protocol is deprecated. Use qadence-protocols instead.",
         | 
| 227 | 
            +
                    with torch.no_grad():
         | 
| 228 | 
            +
                        wf = self.run(circuit=circuit, param_values=param_values, state=state)
         | 
| 229 | 
            +
                        probs = torch.abs(torch.pow(wf, 2))
         | 
| 230 | 
            +
                        samples = list(
         | 
| 231 | 
            +
                            map(
         | 
| 232 | 
            +
                                lambda _probs: _sample(
         | 
| 233 | 
            +
                                    _probs=_probs,
         | 
| 234 | 
            +
                                    n_shots=n_shots,
         | 
| 235 | 
            +
                                    endianness=endianness,
         | 
| 236 | 
            +
                                    n_qubits=circuit.abstract.n_qubits,
         | 
| 237 | 
            +
                                ),
         | 
| 238 | 
            +
                                probs,
         | 
| 239 | 
            +
                            )
         | 
| 243 240 | 
             
                        )
         | 
| 244 | 
            -
                         | 
| 245 | 
            -
             | 
| 246 | 
            -
             | 
| 241 | 
            +
                        if noise is not None:
         | 
| 242 | 
            +
                            samples = apply_noise(noise=noise, samples=samples)
         | 
| 243 | 
            +
                        if mitigation is not None:
         | 
| 244 | 
            +
                            logger.warning(
         | 
| 245 | 
            +
                                "Mitigation protocol is deprecated. Use qadence-protocols instead.",
         | 
| 246 | 
            +
                            )
         | 
| 247 | 
            +
                            assert noise
         | 
| 248 | 
            +
                            samples = apply_mitigation(noise=noise, mitigation=mitigation, samples=samples)
         | 
| 249 | 
            +
                        return samples
         | 
| 247 250 |  | 
| 248 251 | 
             
                def assign_parameters(self, circuit: ConvertedCircuit, param_values: dict[str, Tensor]) -> Any:
         | 
| 249 252 | 
             
                    raise NotImplementedError
         | 
| @@ -4,7 +4,7 @@ from functools import reduce | |
| 4 4 | 
             
            from itertools import chain as flatten
         | 
| 5 5 | 
             
            from math import prod
         | 
| 6 6 | 
             
            from operator import add
         | 
| 7 | 
            -
            from typing import Sequence, Tuple
         | 
| 7 | 
            +
            from typing import Any, Sequence, Tuple
         | 
| 8 8 |  | 
| 9 9 | 
             
            import pyqtorch as pyq
         | 
| 10 10 | 
             
            import sympy
         | 
| @@ -26,6 +26,7 @@ from torch import ( | |
| 26 26 | 
             
                transpose,
         | 
| 27 27 | 
             
            )
         | 
| 28 28 | 
             
            from torch import device as torch_device
         | 
| 29 | 
            +
            from torch import dtype as torch_dtype
         | 
| 29 30 | 
             
            from torch.nn import Module
         | 
| 30 31 |  | 
| 31 32 | 
             
            from qadence.backends.utils import (
         | 
| @@ -178,6 +179,7 @@ class PyQMatrixBlock(Module): | |
| 178 179 | 
             
                    self.register_buffer("mat", block.matrix.unsqueeze(2))
         | 
| 179 180 | 
             
                    self.mat: Tensor
         | 
| 180 181 | 
             
                    self._device: torch_device = self.mat.device
         | 
| 182 | 
            +
                    self._dtype: torch_dtype = self.mat.dtype
         | 
| 181 183 |  | 
| 182 184 | 
             
                def forward(self, state: Tensor, _: dict[str, Tensor] = None) -> Tensor:
         | 
| 183 185 | 
             
                    return apply_operator(state, self.mat, self.qubits, self.n_qubits)
         | 
| @@ -186,9 +188,10 @@ class PyQMatrixBlock(Module): | |
| 186 188 | 
             
                def device(self) -> torch_device:
         | 
| 187 189 | 
             
                    return self._device
         | 
| 188 190 |  | 
| 189 | 
            -
                def to(self,  | 
| 190 | 
            -
                    self.mat = self.mat.to( | 
| 191 | 
            -
                    self._device = device
         | 
| 191 | 
            +
                def to(self, *args: Any, **kwargs: Any) -> PyQMatrixBlock:
         | 
| 192 | 
            +
                    self.mat = self.mat.to(*args, **kwargs)
         | 
| 193 | 
            +
                    self._device = self.mat.device
         | 
| 194 | 
            +
                    self._dtype = self.mat.dtype
         | 
| 192 195 | 
             
                    return self
         | 
| 193 196 |  | 
| 194 197 |  | 
| @@ -262,6 +265,7 @@ class PyQObservable(Module): | |
| 262 265 | 
             
                        )
         | 
| 263 266 | 
             
                        self._forward = lambda self, state, values: self.operation(state, values)
         | 
| 264 267 | 
             
                    self._device = self.operation.device
         | 
| 268 | 
            +
                    self._dtype = self.operation.dtype
         | 
| 265 269 |  | 
| 266 270 | 
             
                def run(self, state: Tensor, values: dict[str, Tensor]) -> Tensor:
         | 
| 267 271 | 
             
                    return self._forward(self, state, values)
         | 
| @@ -273,9 +277,14 @@ class PyQObservable(Module): | |
| 273 277 | 
             
                def device(self) -> torch_device:
         | 
| 274 278 | 
             
                    return self._device
         | 
| 275 279 |  | 
| 276 | 
            -
                 | 
| 277 | 
            -
             | 
| 278 | 
            -
                    self. | 
| 280 | 
            +
                @property
         | 
| 281 | 
            +
                def dtype(self) -> torch_dtype:
         | 
| 282 | 
            +
                    return self._dtype
         | 
| 283 | 
            +
             | 
| 284 | 
            +
                def to(self, *args: Any, **kwargs: Any) -> PyQObservable:
         | 
| 285 | 
            +
                    self.operation = self.operation.to(*args, **kwargs)
         | 
| 286 | 
            +
                    self._device = self.operation.device
         | 
| 287 | 
            +
                    self._dtype = self.operation.dtype
         | 
| 279 288 | 
             
                    return self
         | 
| 280 289 |  | 
| 281 290 |  | 
| @@ -338,6 +347,7 @@ class PyQHamiltonianEvolution(Module): | |
| 338 347 | 
             
                    self._device: torch_device = (
         | 
| 339 348 | 
             
                        self.hmat.device if hasattr(self, "hmat") else torch_device("cpu")
         | 
| 340 349 | 
             
                    )
         | 
| 350 | 
            +
                    self._dtype: torch_dtype = self.hmat.dtype if hasattr(self, "hmat") else cdouble
         | 
| 341 351 |  | 
| 342 352 | 
             
                def _unitary(self, hamiltonian: Tensor, time_evolution: Tensor) -> Tensor:
         | 
| 343 353 | 
             
                    self.batch_size = max(hamiltonian.size()[2], len(time_evolution))
         | 
| @@ -419,10 +429,15 @@ class PyQHamiltonianEvolution(Module): | |
| 419 429 | 
             
                def device(self) -> torch_device:
         | 
| 420 430 | 
             
                    return self._device
         | 
| 421 431 |  | 
| 422 | 
            -
                 | 
| 432 | 
            +
                @property
         | 
| 433 | 
            +
                def dtype(self) -> torch_dtype:
         | 
| 434 | 
            +
                    return self._dtype
         | 
| 435 | 
            +
             | 
| 436 | 
            +
                def to(self, *args: Any, **kwargs: Any) -> PyQHamiltonianEvolution:
         | 
| 423 437 | 
             
                    if hasattr(self, "hmat"):
         | 
| 424 | 
            -
                        self.hmat = self.hmat.to( | 
| 425 | 
            -
             | 
| 438 | 
            +
                        self.hmat = self.hmat.to(*args, **kwargs)
         | 
| 439 | 
            +
                        self._device = self.hmat.device
         | 
| 440 | 
            +
                        self._dtype = self.hmat.dtype
         | 
| 426 441 | 
             
                    return self
         | 
| 427 442 |  | 
| 428 443 |  | 
    
        qadence/backends/utils.py
    CHANGED
    
    | @@ -13,6 +13,7 @@ from pyqtorch.parametric import Parametric as PyQParametric | |
| 13 13 | 
             
            from torch import (
         | 
| 14 14 | 
             
                Tensor,
         | 
| 15 15 | 
             
                cat,
         | 
| 16 | 
            +
                complex64,
         | 
| 16 17 | 
             
                complex128,
         | 
| 17 18 | 
             
                mean,
         | 
| 18 19 | 
             
                no_grad,
         | 
| @@ -129,8 +130,8 @@ def is_pyq_shape(state: Tensor, n_qubits: int) -> bool: | |
| 129 130 |  | 
| 130 131 | 
             
            def validate_state(state: Tensor, n_qubits: int) -> None:
         | 
| 131 132 | 
             
                """Check if a custom initial state conforms to the qadence or the pyqtorch format."""
         | 
| 132 | 
            -
                if state.dtype  | 
| 133 | 
            -
                    raise TypeError(f"Expected  | 
| 133 | 
            +
                if state.dtype not in [complex128, complex64]:
         | 
| 134 | 
            +
                    raise TypeError(f"Expected complex dtype, got {state.dtype}")
         | 
| 134 135 | 
             
                elif len(state.size()) < 2:
         | 
| 135 136 | 
             
                    raise ValueError(f"Invalid state shape. Got {state.shape}")
         | 
| 136 137 | 
             
                elif not is_qadence_shape(state, n_qubits) and not is_pyq_shape(state, n_qubits):
         | 
| @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            from __future__ import annotations
         | 
| 2 2 |  | 
| 3 | 
            -
            from collections import  | 
| 3 | 
            +
            from collections import OrderedDict
         | 
| 4 4 | 
             
            from dataclasses import dataclass
         | 
| 5 5 | 
             
            from functools import partial
         | 
| 6 6 | 
             
            from typing import Any, Callable, Sequence
         | 
| @@ -8,22 +8,19 @@ from typing import Any, Callable, Sequence | |
| 8 8 | 
             
            import torch
         | 
| 9 9 | 
             
            from torch import Tensor
         | 
| 10 10 | 
             
            from torch.autograd import Function
         | 
| 11 | 
            -
            from torch.nn import Module
         | 
| 12 11 |  | 
| 13 12 | 
             
            from qadence.backend import Backend as QuantumBackend
         | 
| 14 | 
            -
            from qadence.backend import  | 
| 13 | 
            +
            from qadence.backend import ConvertedCircuit, ConvertedObservable
         | 
| 15 14 | 
             
            from qadence.backends.adjoint import AdjointExpectation
         | 
| 16 15 | 
             
            from qadence.backends.utils import infer_batchsize, is_pyq_shape, param_dict, pyqify, validate_state
         | 
| 17 16 | 
             
            from qadence.blocks.abstract import AbstractBlock
         | 
| 18 | 
            -
            from qadence.blocks. | 
| 19 | 
            -
            from qadence.blocks.utils import uuid_to_block, uuid_to_eigen
         | 
| 17 | 
            +
            from qadence.blocks.utils import uuid_to_eigen
         | 
| 20 18 | 
             
            from qadence.circuit import QuantumCircuit
         | 
| 21 | 
            -
            from qadence.extensions import get_gpsr_fns
         | 
| 22 19 | 
             
            from qadence.measurements import Measurements
         | 
| 23 20 | 
             
            from qadence.mitigations import Mitigations
         | 
| 24 21 | 
             
            from qadence.ml_tools import promote_to_tensor
         | 
| 25 22 | 
             
            from qadence.noise import Noise
         | 
| 26 | 
            -
            from qadence.types import  | 
| 23 | 
            +
            from qadence.types import Endianness
         | 
| 27 24 |  | 
| 28 25 |  | 
| 29 26 | 
             
            class PSRExpectation(Function):
         | 
| @@ -232,160 +229,3 @@ class DifferentiableExpectation: | |
| 232 229 | 
             
                            # Since they are constants their gradients are 0.
         | 
| 233 230 | 
             
                            param_to_psr[param_id] = lambda x: torch.tensor([0.0], requires_grad=False)
         | 
| 234 231 | 
             
                    return param_to_psr
         | 
| 235 | 
            -
             | 
| 236 | 
            -
             | 
| 237 | 
            -
            class DifferentiableBackend(Module):
         | 
| 238 | 
            -
                """A class to abstract the operations done by the autodiff engine.
         | 
| 239 | 
            -
             | 
| 240 | 
            -
                Arguments:
         | 
| 241 | 
            -
                    backend: An instance of the QuantumBackend type perform execution.
         | 
| 242 | 
            -
                    diff_mode: A differentiable mode supported by the differentiation engine.
         | 
| 243 | 
            -
                    **psr_args: Arguments that will be passed on to `DifferentiableExpectation`.
         | 
| 244 | 
            -
                """
         | 
| 245 | 
            -
             | 
| 246 | 
            -
                def __init__(
         | 
| 247 | 
            -
                    self,
         | 
| 248 | 
            -
                    backend: QuantumBackend,
         | 
| 249 | 
            -
                    diff_mode: DiffMode = DiffMode.AD,
         | 
| 250 | 
            -
                    **psr_args: int | float | None,
         | 
| 251 | 
            -
                ) -> None:
         | 
| 252 | 
            -
                    super().__init__()
         | 
| 253 | 
            -
             | 
| 254 | 
            -
                    self.backend = backend
         | 
| 255 | 
            -
                    self.diff_mode = diff_mode
         | 
| 256 | 
            -
                    self.psr_args = psr_args
         | 
| 257 | 
            -
                    # TODO: Add differentiable overlap calculation
         | 
| 258 | 
            -
                    self._overlap: Callable = None  # type: ignore [assignment]
         | 
| 259 | 
            -
             | 
| 260 | 
            -
                def run(
         | 
| 261 | 
            -
                    self,
         | 
| 262 | 
            -
                    circuit: ConvertedCircuit,
         | 
| 263 | 
            -
                    param_values: dict = {},
         | 
| 264 | 
            -
                    state: Tensor | None = None,
         | 
| 265 | 
            -
                    endianness: Endianness = Endianness.BIG,
         | 
| 266 | 
            -
                ) -> Tensor:
         | 
| 267 | 
            -
                    """Run on the underlying backend."""
         | 
| 268 | 
            -
                    return self.backend.run(
         | 
| 269 | 
            -
                        circuit=circuit, param_values=param_values, state=state, endianness=endianness
         | 
| 270 | 
            -
                    )
         | 
| 271 | 
            -
             | 
| 272 | 
            -
                def expectation(
         | 
| 273 | 
            -
                    self,
         | 
| 274 | 
            -
                    circuit: ConvertedCircuit,
         | 
| 275 | 
            -
                    observable: list[ConvertedObservable] | ConvertedObservable,
         | 
| 276 | 
            -
                    param_values: dict[str, Tensor] = {},
         | 
| 277 | 
            -
                    state: Tensor | None = None,
         | 
| 278 | 
            -
                    measurement: Measurements | None = None,
         | 
| 279 | 
            -
                    noise: Noise | None = None,
         | 
| 280 | 
            -
                    mitigation: Mitigations | None = None,
         | 
| 281 | 
            -
                    endianness: Endianness = Endianness.BIG,
         | 
| 282 | 
            -
                ) -> Tensor:
         | 
| 283 | 
            -
                    """Compute the expectation value of a given observable.
         | 
| 284 | 
            -
             | 
| 285 | 
            -
                    Arguments:
         | 
| 286 | 
            -
                        circuit: A backend native quantum circuit to be executed.
         | 
| 287 | 
            -
                        observable: A backend native observable to compute the expectation value from.
         | 
| 288 | 
            -
                        param_values: A dict of values for symbolic substitution.
         | 
| 289 | 
            -
                        state: An initial state.
         | 
| 290 | 
            -
                        measurement: A shot-based measurement protocol.
         | 
| 291 | 
            -
                        endianness: Endianness of the state.
         | 
| 292 | 
            -
             | 
| 293 | 
            -
                    Returns:
         | 
| 294 | 
            -
                        A tensor of expectation values.
         | 
| 295 | 
            -
                    """
         | 
| 296 | 
            -
                    observable = observable if isinstance(observable, list) else [observable]
         | 
| 297 | 
            -
                    differentiable_expectation = DifferentiableExpectation(
         | 
| 298 | 
            -
                        backend=self.backend,
         | 
| 299 | 
            -
                        circuit=circuit,
         | 
| 300 | 
            -
                        observable=observable,
         | 
| 301 | 
            -
                        param_values=param_values,
         | 
| 302 | 
            -
                        state=state,
         | 
| 303 | 
            -
                        measurement=measurement,
         | 
| 304 | 
            -
                        noise=noise,
         | 
| 305 | 
            -
                        mitigation=mitigation,
         | 
| 306 | 
            -
                        endianness=endianness,
         | 
| 307 | 
            -
                    )
         | 
| 308 | 
            -
             | 
| 309 | 
            -
                    if self.diff_mode == DiffMode.AD:
         | 
| 310 | 
            -
                        expectation = differentiable_expectation.ad
         | 
| 311 | 
            -
                    elif self.diff_mode == DiffMode.ADJOINT:
         | 
| 312 | 
            -
                        expectation = differentiable_expectation.adjoint
         | 
| 313 | 
            -
                    else:
         | 
| 314 | 
            -
                        try:
         | 
| 315 | 
            -
                            fns = get_gpsr_fns()
         | 
| 316 | 
            -
                            psr_fn = fns[self.diff_mode]
         | 
| 317 | 
            -
                        except KeyError:
         | 
| 318 | 
            -
                            raise ValueError(f"{self.diff_mode} differentiation mode is not supported")
         | 
| 319 | 
            -
                        expectation = partial(differentiable_expectation.psr, psr_fn=psr_fn, **self.psr_args)
         | 
| 320 | 
            -
                    return expectation()
         | 
| 321 | 
            -
             | 
| 322 | 
            -
                def sample(
         | 
| 323 | 
            -
                    self,
         | 
| 324 | 
            -
                    circuit: ConvertedCircuit,
         | 
| 325 | 
            -
                    param_values: dict[str, Tensor],
         | 
| 326 | 
            -
                    n_shots: int = 1,
         | 
| 327 | 
            -
                    state: Tensor | None = None,
         | 
| 328 | 
            -
                    noise: Noise | None = None,
         | 
| 329 | 
            -
                    mitigation: Mitigations | None = None,
         | 
| 330 | 
            -
                    endianness: Endianness = Endianness.BIG,
         | 
| 331 | 
            -
                ) -> list[Counter]:
         | 
| 332 | 
            -
                    """Sample bitstring from the registered circuit.
         | 
| 333 | 
            -
             | 
| 334 | 
            -
                    Arguments:
         | 
| 335 | 
            -
                        circuit: A backend native quantum circuit to be executed.
         | 
| 336 | 
            -
                        param_values: The values of the parameters after embedding
         | 
| 337 | 
            -
                        n_shots: The number of shots. Defaults to 1.
         | 
| 338 | 
            -
                        state: Initial state.
         | 
| 339 | 
            -
                        noise: A noise model to use.
         | 
| 340 | 
            -
                        mitigation: A mitigation protocol to apply to noisy samples.
         | 
| 341 | 
            -
                        endianness: Endianness of the resulting bitstrings.
         | 
| 342 | 
            -
             | 
| 343 | 
            -
                    Returns:
         | 
| 344 | 
            -
                        An iterable with all the sampled bitstrings
         | 
| 345 | 
            -
                    """
         | 
| 346 | 
            -
                    with torch.no_grad():
         | 
| 347 | 
            -
                        return self.backend.sample(
         | 
| 348 | 
            -
                            circuit=circuit,
         | 
| 349 | 
            -
                            param_values=param_values,
         | 
| 350 | 
            -
                            n_shots=n_shots,
         | 
| 351 | 
            -
                            state=state,
         | 
| 352 | 
            -
                            noise=noise,
         | 
| 353 | 
            -
                            mitigation=mitigation,
         | 
| 354 | 
            -
                            endianness=endianness,
         | 
| 355 | 
            -
                        )
         | 
| 356 | 
            -
             | 
| 357 | 
            -
                def circuit(self, circuit: QuantumCircuit) -> ConvertedCircuit:
         | 
| 358 | 
            -
                    parametrized_blocks = list(uuid_to_block(circuit.block).values())
         | 
| 359 | 
            -
                    non_prim_blocks = filter(lambda b: not isinstance(b, PrimitiveBlock), parametrized_blocks)
         | 
| 360 | 
            -
                    if len(list(non_prim_blocks)) > 0:
         | 
| 361 | 
            -
                        raise ValueError(
         | 
| 362 | 
            -
                            "The circuit contains non-primitive blocks that are currently not supported by the "
         | 
| 363 | 
            -
                            "PSR differentiable mode."
         | 
| 364 | 
            -
                        )
         | 
| 365 | 
            -
                    return self.backend.circuit(circuit)
         | 
| 366 | 
            -
             | 
| 367 | 
            -
                def observable(self, observable: AbstractBlock, n_qubits: int) -> ConvertedObservable:
         | 
| 368 | 
            -
                    if observable is not None and observable.is_parametric:
         | 
| 369 | 
            -
                        raise ValueError("PSR cannot be applied to a parametric observable.")
         | 
| 370 | 
            -
                    return self.backend.observable(observable, n_qubits)
         | 
| 371 | 
            -
             | 
| 372 | 
            -
                def convert(
         | 
| 373 | 
            -
                    self,
         | 
| 374 | 
            -
                    circuit: QuantumCircuit,
         | 
| 375 | 
            -
                    observable: list[AbstractBlock] | AbstractBlock | None = None,
         | 
| 376 | 
            -
                ) -> Converted:
         | 
| 377 | 
            -
                    if self.diff_mode != DiffMode.AD and observable is not None:
         | 
| 378 | 
            -
                        msg = (
         | 
| 379 | 
            -
                            f"Differentiation mode '{self.diff_mode}' does not support parametric observables."
         | 
| 380 | 
            -
                        )
         | 
| 381 | 
            -
                        if isinstance(observable, list):
         | 
| 382 | 
            -
                            for obs in observable:
         | 
| 383 | 
            -
                                if obs.is_parametric:
         | 
| 384 | 
            -
                                    raise ValueError(msg)
         | 
| 385 | 
            -
                        else:
         | 
| 386 | 
            -
                            if observable.is_parametric:
         | 
| 387 | 
            -
                                raise ValueError(msg)
         | 
| 388 | 
            -
                    return self.backend.convert(circuit, observable)
         | 
| 389 | 
            -
             | 
| 390 | 
            -
                def assign_parameters(self, circuit: ConvertedCircuit, param_values: dict[str, Tensor]) -> Any:
         | 
| 391 | 
            -
                    return self.backend.assign_parameters(circuit, param_values)
         | 
    
        qadence/libs.py
    ADDED
    
    | @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            from __future__ import annotations
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            import importlib
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            from qadence.logger import get_logger
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            logger = get_logger(__name__)
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            try:
         | 
| 10 | 
            +
                module = importlib.import_module("qadence_libs.protocols")
         | 
| 11 | 
            +
                available_libs = getattr(module, "available_libs")
         | 
| 12 | 
            +
            except ModuleNotFoundError:
         | 
| 13 | 
            +
                raise ModuleNotFoundError(
         | 
| 14 | 
            +
                    "The 'qadence_libs' module is not present." " Please install the 'qadence-libs' package."
         | 
| 15 | 
            +
                )
         | 
    
        qadence/ml_tools/data.py
    CHANGED
    
    | @@ -82,34 +82,34 @@ def to_dataloader(*tensors: Tensor, batch_size: int = 1, infinite: bool = False) | |
| 82 82 |  | 
| 83 83 |  | 
| 84 84 | 
             
            @singledispatch
         | 
| 85 | 
            -
            def data_to_device(xs: Any,  | 
| 85 | 
            +
            def data_to_device(xs: Any, *args: Any, **kwargs: Any) -> Any:
         | 
| 86 86 | 
             
                """Utility method to move arbitrary data to 'device'."""
         | 
| 87 | 
            -
                raise ValueError(f" | 
| 87 | 
            +
                raise ValueError(f"Unable to move {type(xs)} with input args: {args} and kwargs: {kwargs}.")
         | 
| 88 88 |  | 
| 89 89 |  | 
| 90 90 | 
             
            @data_to_device.register
         | 
| 91 | 
            -
            def _(xs: None,  | 
| 91 | 
            +
            def _(xs: None, *args: Any, **kwargs: Any) -> None:
         | 
| 92 92 | 
             
                return xs
         | 
| 93 93 |  | 
| 94 94 |  | 
| 95 95 | 
             
            @data_to_device.register(Tensor)
         | 
| 96 | 
            -
            def _(xs: Tensor,  | 
| 97 | 
            -
                return xs.to( | 
| 96 | 
            +
            def _(xs: Tensor, *args: Any, **kwargs: Any) -> Tensor:
         | 
| 97 | 
            +
                return xs.to(*args, **kwargs)
         | 
| 98 98 |  | 
| 99 99 |  | 
| 100 100 | 
             
            @data_to_device.register(list)
         | 
| 101 | 
            -
            def _(xs: list,  | 
| 102 | 
            -
                return [data_to_device(x,  | 
| 101 | 
            +
            def _(xs: list, *args: Any, **kwargs: Any) -> list:
         | 
| 102 | 
            +
                return [data_to_device(x, *args, **kwargs) for x in xs]
         | 
| 103 103 |  | 
| 104 104 |  | 
| 105 105 | 
             
            @data_to_device.register(dict)
         | 
| 106 | 
            -
            def _(xs: dict,  | 
| 107 | 
            -
                return {key: data_to_device(val,  | 
| 106 | 
            +
            def _(xs: dict, *args: Any, **kwargs: Any) -> dict:
         | 
| 107 | 
            +
                return {key: data_to_device(val, *args, **kwargs) for key, val in xs.items()}
         | 
| 108 108 |  | 
| 109 109 |  | 
| 110 110 | 
             
            @data_to_device.register(DataLoader)
         | 
| 111 | 
            -
            def _(xs: DataLoader,  | 
| 112 | 
            -
                return DataLoader(data_to_device(xs.dataset,  | 
| 111 | 
            +
            def _(xs: DataLoader, *args: Any, **kwargs: Any) -> DataLoader:
         | 
| 112 | 
            +
                return DataLoader(data_to_device(xs.dataset, *args, **kwargs))
         | 
| 113 113 |  | 
| 114 114 |  | 
| 115 115 | 
             
            @data_to_device.register(DictDataLoader)
         | 
    
        qadence/ml_tools/models.py
    CHANGED
    
    | @@ -286,15 +286,27 @@ class TransformedModule(torch.nn.Module): | |
| 286 286 | 
             
                        output_shifting=torch.tensor(d["_output_shifting"]),
         | 
| 287 287 | 
             
                    )
         | 
| 288 288 |  | 
| 289 | 
            -
                def to(self,  | 
| 289 | 
            +
                def to(self, *args: Any, **kwargs: Any) -> TransformedModule:
         | 
| 290 290 | 
             
                    try:
         | 
| 291 | 
            -
                        self.model = self.model.to( | 
| 292 | 
            -
                        self. | 
| 293 | 
            -
             | 
| 294 | 
            -
             | 
| 295 | 
            -
             | 
| 296 | 
            -
             | 
| 297 | 
            -
             | 
| 291 | 
            +
                        self.model = self.model.to(*args, **kwargs)
         | 
| 292 | 
            +
                        if isinstance(self.model, QuantumModel):
         | 
| 293 | 
            +
                            device = self.model._circuit.native.device
         | 
| 294 | 
            +
                            dtype = (
         | 
| 295 | 
            +
                                torch.float64
         | 
| 296 | 
            +
                                if self.model._circuit.native.dtype == torch.cdouble
         | 
| 297 | 
            +
                                else torch.float32
         | 
| 298 | 
            +
                            )
         | 
| 299 | 
            +
             | 
| 300 | 
            +
                            self._input_scaling = self._input_scaling.to(device=device, dtype=dtype)
         | 
| 301 | 
            +
                            self._input_shifting = self._input_shifting.to(device=device, dtype=dtype)
         | 
| 302 | 
            +
                            self._output_scaling = self._output_scaling.to(device=device, dtype=dtype)
         | 
| 303 | 
            +
                            self._output_shifting = self._output_shifting.to(device=device, dtype=dtype)
         | 
| 304 | 
            +
                        elif isinstance(self.model, torch.nn.Module):
         | 
| 305 | 
            +
                            self._input_scaling = self._input_scaling.to(*args, **kwargs)
         | 
| 306 | 
            +
                            self._input_shifting = self._input_shifting.to(*args, **kwargs)
         | 
| 307 | 
            +
                            self._output_scaling = self._output_scaling.to(*args, **kwargs)
         | 
| 308 | 
            +
                            self._output_shifting = self._output_shifting.to(*args, **kwargs)
         | 
| 309 | 
            +
                        logger.debug(f"Moved {self} to {args}, {kwargs}.")
         | 
| 298 310 | 
             
                    except Exception as e:
         | 
| 299 | 
            -
                        logger.warning(f"Unable to move {self} to  | 
| 311 | 
            +
                        logger.warning(f"Unable to move {self} to {args}, {kwargs} due to {e}.")
         | 
| 300 312 | 
             
                    return self
         | 
| @@ -15,6 +15,7 @@ def optimize_step( | |
| 15 15 | 
             
                loss_fn: Callable,
         | 
| 16 16 | 
             
                xs: dict | list | torch.Tensor | None,
         | 
| 17 17 | 
             
                device: torch.device = None,
         | 
| 18 | 
            +
                dtype: torch.dtype = None,
         | 
| 18 19 | 
             
            ) -> tuple[torch.Tensor | float, dict | None]:
         | 
| 19 20 | 
             
                """Default Torch optimize step with closure.
         | 
| 20 21 |  | 
| @@ -35,7 +36,7 @@ def optimize_step( | |
| 35 36 | 
             
                """
         | 
| 36 37 |  | 
| 37 38 | 
             
                loss, metrics = None, {}
         | 
| 38 | 
            -
                xs_to_device = data_to_device(xs, device)
         | 
| 39 | 
            +
                xs_to_device = data_to_device(xs, device=device, dtype=dtype)
         | 
| 39 40 |  | 
| 40 41 | 
             
                def closure() -> Any:
         | 
| 41 42 | 
             
                    # NOTE: We need the nonlocal as we can't return a metric dict and
         | 
    
        qadence/ml_tools/train_grad.py
    CHANGED
    
    | @@ -3,7 +3,9 @@ from __future__ import annotations | |
| 3 3 | 
             
            from typing import Callable, Union
         | 
| 4 4 |  | 
| 5 5 | 
             
            from rich.progress import BarColumn, Progress, TaskProgressColumn, TextColumn, TimeRemainingColumn
         | 
| 6 | 
            +
            from torch import complex128, float32, float64
         | 
| 6 7 | 
             
            from torch import device as torch_device
         | 
| 8 | 
            +
            from torch import dtype as torch_dtype
         | 
| 7 9 | 
             
            from torch.nn import DataParallel, Module
         | 
| 8 10 | 
             
            from torch.optim import Optimizer
         | 
| 9 11 | 
             
            from torch.utils.data import DataLoader
         | 
| @@ -28,6 +30,7 @@ def train( | |
| 28 30 | 
             
                device: torch_device = None,
         | 
| 29 31 | 
             
                optimize_step: Callable = optimize_step,
         | 
| 30 32 | 
             
                write_tensorboard: Callable = write_tensorboard,
         | 
| 33 | 
            +
                dtype: torch_dtype = None,
         | 
| 31 34 | 
             
            ) -> tuple[Module, Optimizer]:
         | 
| 32 35 | 
             
                """Runs the training loop with gradient-based optimizer.
         | 
| 33 36 |  | 
| @@ -108,17 +111,17 @@ def train( | |
| 108 111 | 
             
                train_with_grad(model, data, optimizer, config, loss_fn=loss_fn)
         | 
| 109 112 | 
             
                ```
         | 
| 110 113 | 
             
                """
         | 
| 111 | 
            -
             | 
| 112 | 
            -
                # Move model to device before optimizer is loaded
         | 
| 113 | 
            -
                if isinstance(model, DataParallel):
         | 
| 114 | 
            -
                    model = model.module.to(device)
         | 
| 115 | 
            -
                else:
         | 
| 116 | 
            -
                    model = model.to(device)
         | 
| 117 114 | 
             
                # load available checkpoint
         | 
| 118 115 | 
             
                init_iter = 0
         | 
| 119 116 | 
             
                if config.folder:
         | 
| 120 117 | 
             
                    model, optimizer, init_iter = load_checkpoint(config.folder, model, optimizer)
         | 
| 121 118 | 
             
                    logger.debug(f"Loaded model and optimizer from {config.folder}")
         | 
| 119 | 
            +
             | 
| 120 | 
            +
                # Move model to device before optimizer is loaded
         | 
| 121 | 
            +
                if isinstance(model, DataParallel):
         | 
| 122 | 
            +
                    model = model.module.to(device=device, dtype=dtype)
         | 
| 123 | 
            +
                else:
         | 
| 124 | 
            +
                    model = model.to(device=device, dtype=dtype)
         | 
| 122 125 | 
             
                # initialize tensorboard
         | 
| 123 126 | 
             
                writer = SummaryWriter(config.folder, purge_step=init_iter)
         | 
| 124 127 |  | 
| @@ -129,7 +132,9 @@ def train( | |
| 129 132 | 
             
                    TaskProgressColumn(),
         | 
| 130 133 | 
             
                    TimeRemainingColumn(elapsed_when_finished=True),
         | 
| 131 134 | 
             
                )
         | 
| 132 | 
            -
             | 
| 135 | 
            +
                data_dtype = None
         | 
| 136 | 
            +
                if dtype:
         | 
| 137 | 
            +
                    data_dtype = float64 if dtype == complex128 else float32
         | 
| 133 138 | 
             
                with progress:
         | 
| 134 139 | 
             
                    dl_iter = iter(dataloader) if dataloader is not None else None
         | 
| 135 140 |  | 
| @@ -141,7 +146,12 @@ def train( | |
| 141 146 | 
             
                            # which do not have classical input data (e.g. chemistry)
         | 
| 142 147 | 
             
                            if dataloader is None:
         | 
| 143 148 | 
             
                                loss, metrics = optimize_step(
         | 
| 144 | 
            -
                                    model=model, | 
| 149 | 
            +
                                    model=model,
         | 
| 150 | 
            +
                                    optimizer=optimizer,
         | 
| 151 | 
            +
                                    loss_fn=loss_fn,
         | 
| 152 | 
            +
                                    xs=None,
         | 
| 153 | 
            +
                                    device=device,
         | 
| 154 | 
            +
                                    dtype=data_dtype,
         | 
| 145 155 | 
             
                                )
         | 
| 146 156 | 
             
                                loss = loss.item()
         | 
| 147 157 |  | 
| @@ -152,6 +162,7 @@ def train( | |
| 152 162 | 
             
                                    loss_fn=loss_fn,
         | 
| 153 163 | 
             
                                    xs=next(dl_iter),  # type: ignore[arg-type]
         | 
| 154 164 | 
             
                                    device=device,
         | 
| 165 | 
            +
                                    dtype=data_dtype,
         | 
| 155 166 | 
             
                                )
         | 
| 156 167 |  | 
| 157 168 | 
             
                            else:
         | 
    
        qadence/models/quantum_model.py
    CHANGED
    
    | @@ -341,19 +341,27 @@ class QuantumModel(nn.Module): | |
| 341 341 | 
             
                    params = self.embedding_fn(self._params, values)
         | 
| 342 342 | 
             
                    return self.backend.assign_parameters(self._circuit, params)
         | 
| 343 343 |  | 
| 344 | 
            -
                def to(self,  | 
| 344 | 
            +
                def to(self, *args: Any, **kwargs: Any) -> QuantumModel:
         | 
| 345 | 
            +
                    from pyqtorch import QuantumCircuit as PyQCircuit
         | 
| 346 | 
            +
             | 
| 345 347 | 
             
                    try:
         | 
| 346 | 
            -
                        if isinstance(self._circuit.native,  | 
| 347 | 
            -
                             | 
| 348 | 
            -
                            self._params = self._params.to(device)
         | 
| 349 | 
            -
                            self._circuit.native = self._circuit.native.to(device)
         | 
| 348 | 
            +
                        if isinstance(self._circuit.native, PyQCircuit):
         | 
| 349 | 
            +
                            self._circuit.native = self._circuit.native.to(*args, **kwargs)
         | 
| 350 350 | 
             
                            if self._observable is not None:
         | 
| 351 351 | 
             
                                if isinstance(self._observable, ConvertedObservable):
         | 
| 352 | 
            -
                                    self._observable.native = self._observable.native.to( | 
| 352 | 
            +
                                    self._observable.native = self._observable.native.to(*args, **kwargs)
         | 
| 353 353 | 
             
                                elif isinstance(self._observable, list):
         | 
| 354 354 | 
             
                                    for obs in self._observable:
         | 
| 355 | 
            -
                                        obs.native = obs.native.to( | 
| 356 | 
            -
                             | 
| 355 | 
            +
                                        obs.native = obs.native.to(*args, **kwargs)
         | 
| 356 | 
            +
                            self._params = self._params.to(
         | 
| 357 | 
            +
                                device=self._circuit.native.device,
         | 
| 358 | 
            +
                                dtype=torch.float64
         | 
| 359 | 
            +
                                if self._circuit.native.dtype == torch.cdouble
         | 
| 360 | 
            +
                                else torch.float32,
         | 
| 361 | 
            +
                            )
         | 
| 362 | 
            +
                            logger.debug(f"Moved {self} to {args}, {kwargs}.")
         | 
| 363 | 
            +
                        else:
         | 
| 364 | 
            +
                            logger.debug("QuantumModel.to only supports pyqtorch.QuantumCircuits.")
         | 
| 357 365 | 
             
                    except Exception as e:
         | 
| 358 | 
            -
                        logger.warning(f"Unable to move {self} to  | 
| 366 | 
            +
                        logger.warning(f"Unable to move {self} to {args}, {kwargs} due to {e}.")
         | 
| 359 367 | 
             
                    return self
         | 
| @@ -1,6 +1,6 @@ | |
| 1 | 
            -
            Metadata-Version: 2. | 
| 1 | 
            +
            Metadata-Version: 2.3
         | 
| 2 2 | 
             
            Name: qadence
         | 
| 3 | 
            -
            Version: 1. | 
| 3 | 
            +
            Version: 1.5.1
         | 
| 4 4 | 
             
            Summary: Pasqal interface for circuit-based quantum computing SDKs
         | 
| 5 5 | 
             
            Author-email: Aleksander Wennersteen <aleksander.wennersteen@pasqal.com>, Gert-Jan Both <gert-jan.both@pasqal.com>, Niklas Heim <niklas.heim@pasqal.com>, Mario Dagrada <mario.dagrada@pasqal.com>, Vincent Elfving <vincent.elfving@pasqal.com>, Dominik Seitz <dominik.seitz@pasqal.com>, Roland Guichard <roland.guichard@pasqal.com>, "Joao P. Moutinho" <joao.moutinho@pasqal.com>, Vytautas Abramavicius <vytautas.abramavicius@pasqal.com>, Gergana Velikova <gergana.velikova@pasqal.com>
         | 
| 6 6 | 
             
            License: Apache 2.0
         | 
| @@ -13,14 +13,14 @@ Classifier: Programming Language :: Python :: 3.10 | |
| 13 13 | 
             
            Classifier: Programming Language :: Python :: 3.11
         | 
| 14 14 | 
             
            Classifier: Programming Language :: Python :: Implementation :: CPython
         | 
| 15 15 | 
             
            Classifier: Programming Language :: Python :: Implementation :: PyPy
         | 
| 16 | 
            -
            Requires-Python: <3. | 
| 16 | 
            +
            Requires-Python: <3.13,>=3.9
         | 
| 17 17 | 
             
            Requires-Dist: deepdiff
         | 
| 18 18 | 
             
            Requires-Dist: jsonschema
         | 
| 19 19 | 
             
            Requires-Dist: matplotlib
         | 
| 20 20 | 
             
            Requires-Dist: nevergrad
         | 
| 21 21 | 
             
            Requires-Dist: numpy
         | 
| 22 22 | 
             
            Requires-Dist: openfermion
         | 
| 23 | 
            -
            Requires-Dist: pyqtorch==1.0 | 
| 23 | 
            +
            Requires-Dist: pyqtorch==1.1.0
         | 
| 24 24 | 
             
            Requires-Dist: rich
         | 
| 25 25 | 
             
            Requires-Dist: scipy
         | 
| 26 26 | 
             
            Requires-Dist: sympytorch>=0.1.2
         | 
| @@ -29,10 +29,11 @@ Requires-Dist: torch | |
| 29 29 | 
             
            Provides-Extra: all
         | 
| 30 30 | 
             
            Requires-Dist: amazon-braket-sdk; extra == 'all'
         | 
| 31 31 | 
             
            Requires-Dist: graphviz; extra == 'all'
         | 
| 32 | 
            +
            Requires-Dist: libs; extra == 'all'
         | 
| 32 33 | 
             
            Requires-Dist: protocols; extra == 'all'
         | 
| 33 34 | 
             
            Requires-Dist: pulser>=0.15.2; extra == 'all'
         | 
| 34 35 | 
             
            Provides-Extra: braket
         | 
| 35 | 
            -
            Requires-Dist: amazon-braket-sdk; extra == 'braket'
         | 
| 36 | 
            +
            Requires-Dist: amazon-braket-sdk==1.71.0; extra == 'braket'
         | 
| 36 37 | 
             
            Provides-Extra: horqrux
         | 
| 37 38 | 
             
            Requires-Dist: einops; extra == 'horqrux'
         | 
| 38 39 | 
             
            Requires-Dist: flax; extra == 'horqrux'
         | 
| @@ -41,6 +42,8 @@ Requires-Dist: jax; extra == 'horqrux' | |
| 41 42 | 
             
            Requires-Dist: jaxopt; extra == 'horqrux'
         | 
| 42 43 | 
             
            Requires-Dist: optax; extra == 'horqrux'
         | 
| 43 44 | 
             
            Requires-Dist: sympy2jax; extra == 'horqrux'
         | 
| 45 | 
            +
            Provides-Extra: libs
         | 
| 46 | 
            +
            Requires-Dist: qadence-libs; extra == 'libs'
         | 
| 44 47 | 
             
            Provides-Extra: protocols
         | 
| 45 48 | 
             
            Requires-Dist: qadence-protocols; extra == 'protocols'
         | 
| 46 49 | 
             
            Provides-Extra: pulser
         | 
| @@ -106,6 +109,8 @@ The default, pre-installed backend for Qadence is [PyQTorch](https://github.com/ | |
| 106 109 | 
             
            * `pulser`: The [Pulser](https://github.com/pasqal-io/Pulser) backend for composing, simulating and executing pulse sequences for neutral-atom quantum devices.
         | 
| 107 110 | 
             
            * `braket`: The [Braket](https://github.com/amazon-braket/amazon-braket-sdk-python) backend, an open source library that provides a framework for interacting with quantum computing hardware devices through Amazon Braket.
         | 
| 108 111 | 
             
            * `visualization`: A visualization library to display quantum circuit diagrams.
         | 
| 112 | 
            +
            * `protocols`: A collection of [protocols](https://github.com/pasqal-io/qadence-protocols) for error mitigation in Qadence.
         | 
| 113 | 
            +
            * `libs`: A collection of [functionalities](https://github.com/pasqal-io/qadence-libs) for graph machine learning problems build on top of Qadence.
         | 
| 109 114 |  | 
| 110 115 | 
             
            Qadence also supports a `JAX` engine which is currently supporting the [Horqrux](https://github.com/pasqal-io/horqrux) backend. `horqrux` is currently only available via the [low-level API](examples/backends/low_level/horqrux_backend.py).
         | 
| 111 116 |  | 
| @@ -1,11 +1,12 @@ | |
| 1 | 
            -
            qadence/__init__.py,sha256 | 
| 2 | 
            -
            qadence/backend.py,sha256= | 
| 1 | 
            +
            qadence/__init__.py,sha256=-UKQQ_dYiaa7viishl2baAbxS82eS6dAoCnq_CLSmao,1708
         | 
| 2 | 
            +
            qadence/backend.py,sha256=qxTCLfSqjtFAxlu3QgNj_npx_xbY9P2f3SP0mFkL-e8,14410
         | 
| 3 3 | 
             
            qadence/circuit.py,sha256=EGBPRRWlK-mcXaaAhJnp-hxVWQ8NxngGKbvhPqrEeKM,6892
         | 
| 4 4 | 
             
            qadence/decompose.py,sha256=_L0hI3SbYErXEDp-aXFeNk0JR9ffJ_JD_EnRJbJKT20,5230
         | 
| 5 5 | 
             
            qadence/divergences.py,sha256=JhpELhWSnuDvQxa9hJp_DE3EQg2Ban-Ta0mHZ_fVrHg,1832
         | 
| 6 6 | 
             
            qadence/execution.py,sha256=5_P5OSatiwEAu7aAkCLau5VcmtIZiC3VFIj5YYdwAbY,9287
         | 
| 7 7 | 
             
            qadence/extensions.py,sha256=CgaUR3amh80g_zwxGaAjFvgI-JT_pmDiUMzzzVQP7zc,4582
         | 
| 8 8 | 
             
            qadence/finitediff.py,sha256=TijuaWUbX9VlbLyMYco6HkK9eCoRTVnKug4Ekd6mlTI,1592
         | 
| 9 | 
            +
            qadence/libs.py,sha256=HetkKO8TCTlVCViQdVQJvxwBekrhd-y_iMox4UJMY1M,410
         | 
| 9 10 | 
             
            qadence/logger.py,sha256=mdTr52nL30ipPRwp11nIHKLEoB3hqs7J-Mric5KVfyM,912
         | 
| 10 11 | 
             
            qadence/overlap.py,sha256=3vsg0HLOO3X8LiVgvjSc5s-cs8Di4TpEA657LWZ5HEY,17294
         | 
| 11 12 | 
             
            qadence/parameters.py,sha256=svZ3L-Z4pzm2PkPDIlb-DWkwGOQLAm1eECCtu7nd3W0,12334
         | 
| @@ -28,17 +29,17 @@ qadence/backends/adjoint.py,sha256=C2BdLUs2rdV9TiErkVlE0hoeLx_nK7up9mzIO-0vB2g,6 | |
| 28 29 | 
             
            qadence/backends/api.py,sha256=6PoK4ydhi2tj9w0ePMQl1G4kEFROoWe3lrkrtQwWxkc,3224
         | 
| 29 30 | 
             
            qadence/backends/gpsr.py,sha256=227h5KPI_KStrwfP5zuwkzOqviRZmqa7ijIIhhawwPM,4341
         | 
| 30 31 | 
             
            qadence/backends/jax_utils.py,sha256=VfKhqCKknHDWZO21UFipWH_Lkiq175Z5GkP49gWjbyw,5038
         | 
| 31 | 
            -
            qadence/backends/utils.py,sha256= | 
| 32 | 
            +
            qadence/backends/utils.py,sha256=hnV9AXztMvAPcO8mv9UhdGMbS9albiMQBxlYPgLrD68,6490
         | 
| 32 33 | 
             
            qadence/backends/braket/__init__.py,sha256=eruyDZKMqkh1LE7eJ980vcrLJbia35uUX6krAP78clI,121
         | 
| 33 | 
            -
            qadence/backends/braket/backend.py,sha256= | 
| 34 | 
            +
            qadence/backends/braket/backend.py,sha256=XRrrkdylsH8GejbtY8fSJMmX2X7xWmZmEZPxcqWWM5E,8729
         | 
| 34 35 | 
             
            qadence/backends/braket/config.py,sha256=b9aIdma0DRwC_3A6xUSLdXMCZe6z6kDcAgkp6MxcXIk,603
         | 
| 35 36 | 
             
            qadence/backends/braket/convert_ops.py,sha256=DVXV7sT9sX_yGOgPKclD9KIGgmbBRuDy_e39i1Z8I1s,3417
         | 
| 36 37 | 
             
            qadence/backends/horqrux/__init__.py,sha256=0OdVy6cq0oQggV48LO1WXdaZuSkDkz7OYNEPIkNAmfk,140
         | 
| 37 | 
            -
            qadence/backends/horqrux/backend.py,sha256= | 
| 38 | 
            +
            qadence/backends/horqrux/backend.py,sha256=ZOkkklcqqM0T5CTwfSpNAAcW_a0l922h48gj6kPNw4I,9329
         | 
| 38 39 | 
             
            qadence/backends/horqrux/config.py,sha256=fPWFag1hmRhqj0T-fJOx5x8_C5UEZUXpdUnpOgX0Jpc,901
         | 
| 39 40 | 
             
            qadence/backends/horqrux/convert_ops.py,sha256=nzfYF0yjB7zwaHCEXWZUUYDfz38Yi22xF2zDRFaOwR0,8564
         | 
| 40 41 | 
             
            qadence/backends/pulser/__init__.py,sha256=capQ-eHqwtOeLf4mWsI0BIseAHhiLGie5cFD4-iVhUo,116
         | 
| 41 | 
            -
            qadence/backends/pulser/backend.py,sha256= | 
| 42 | 
            +
            qadence/backends/pulser/backend.py,sha256=ZxGg9zLyGTg3gJAZXTL7b96PHvhmN5D4yOAAdnVgLu4,13867
         | 
| 42 43 | 
             
            qadence/backends/pulser/channels.py,sha256=ZF0yEXUFHAmi3IdeXjzdTNGR5NzaRRFTiUpUGVg2sO4,329
         | 
| 43 44 | 
             
            qadence/backends/pulser/cloud.py,sha256=0uUluvbFV9sOuCPraE-9uiVtC3Q8QaDY1IJMDi8grDM,2057
         | 
| 44 45 | 
             
            qadence/backends/pulser/config.py,sha256=1qu_GhGTGcCpFoKctGt_IhKOKWiMcJIL2vHTFJg9I3E,3122
         | 
| @@ -47,9 +48,9 @@ qadence/backends/pulser/devices.py,sha256=DermLZNfmCB3SqteKVW4uhg4jp6ya1G6ptnXbB | |
| 47 48 | 
             
            qadence/backends/pulser/pulses.py,sha256=DopdEZ8eeWK7wZxqJTBhqY0w5bEXu6fVK7rnZOb50ns,11893
         | 
| 48 49 | 
             
            qadence/backends/pulser/waveforms.py,sha256=0uz95b7rUaUUtN0tuHBZmJ0H6UBmfHST_59ozwsRCzg,2227
         | 
| 49 50 | 
             
            qadence/backends/pyqtorch/__init__.py,sha256=0OdVy6cq0oQggV48LO1WXdaZuSkDkz7OYNEPIkNAmfk,140
         | 
| 50 | 
            -
            qadence/backends/pyqtorch/backend.py,sha256= | 
| 51 | 
            +
            qadence/backends/pyqtorch/backend.py,sha256=eaC-yV-Ckgq6YCq1UrrOh6Ug_vFHmUR43RQBiXfcv1Q,9762
         | 
| 51 52 | 
             
            qadence/backends/pyqtorch/config.py,sha256=f5BjWehCqm9do2OahNWrv2w55y3orkw0Wj2f6flwRaU,1907
         | 
| 52 | 
            -
            qadence/backends/pyqtorch/convert_ops.py,sha256= | 
| 53 | 
            +
            qadence/backends/pyqtorch/convert_ops.py,sha256=By_p1-Oem8MhHYP8jx5qdut9lhDWN0xc4B9YaP0MSxA,17512
         | 
| 53 54 | 
             
            qadence/blocks/__init__.py,sha256=H6jEA_CptkE-eoB4UfSbUiDszbxxhZwECV_TgoZWXoU,960
         | 
| 54 55 | 
             
            qadence/blocks/abstract.py,sha256=35RcVlNvD1BmBoJ8bbYJ3LrdU72wixt9ZmTbCtEwNus,11796
         | 
| 55 56 | 
             
            qadence/blocks/analog.py,sha256=ymnnlSVoW1XL05ZvnnHCqRTHuOXIEY_7E9M0PNKJZy4,10812
         | 
| @@ -88,7 +89,7 @@ qadence/engines/jax/differentiable_backend.py,sha256=W5rDA8wb-ECnFWoLj4dVugF9v1l | |
| 88 89 | 
             
            qadence/engines/jax/differentiable_expectation.py,sha256=XBYHT1XKRuZfKxTcNy8KJpSDPt-2PR4ZCanImCPI9OI,3677
         | 
| 89 90 | 
             
            qadence/engines/torch/__init__.py,sha256=iZFdD32ot0B0CVyC-f5dVViOBnqoalxa6M9Lj4WQuPE,160
         | 
| 90 91 | 
             
            qadence/engines/torch/differentiable_backend.py,sha256=AWthwvKE8pCOih4dZ3tXxQX4W1ps9mBcvo7n4V9V24Y,3553
         | 
| 91 | 
            -
            qadence/engines/torch/differentiable_expectation.py,sha256= | 
| 92 | 
            +
            qadence/engines/torch/differentiable_expectation.py,sha256=w_9infZDQRRU7sII8V0aklXrR73IOU0Bjf8C5neJLIY,9161
         | 
| 92 93 | 
             
            qadence/exceptions/__init__.py,sha256=BU6vWrI9mshzr1aTPm1Ticr_o_42GjTrWI4OZXhThsI,203
         | 
| 93 94 | 
             
            qadence/exceptions/exceptions.py,sha256=4j_VJpx2sZ2Mir5BJUWu4nwb131FY1ygO4q8-XlyfRc,190
         | 
| 94 95 | 
             
            qadence/measurements/__init__.py,sha256=RIjG9tVJMqhNzyj7maZI250Um0KgHl2PizDcKJag-JU,161
         | 
| @@ -103,19 +104,19 @@ qadence/mitigations/protocols.py,sha256=Jq9MyLujfTyWmc7XVUGYVRUkJT1MmZw-GgmWpVjm | |
| 103 104 | 
             
            qadence/mitigations/readout.py,sha256=HPfYmdjRlieUdOBMZTghFK4DRWfveM4KkDkEI0bMI0E,6262
         | 
| 104 105 | 
             
            qadence/ml_tools/__init__.py,sha256=_H5A_BWZRZVGoJszb9s8XRJnLnJxUNfYjuT9HT2yASo,786
         | 
| 105 106 | 
             
            qadence/ml_tools/config.py,sha256=X8dHyjq4D9-ITjs7UQo0vjJTcHkpbZC0gChH5eEN2G8,2356
         | 
| 106 | 
            -
            qadence/ml_tools/data.py,sha256= | 
| 107 | 
            -
            qadence/ml_tools/models.py,sha256 | 
| 108 | 
            -
            qadence/ml_tools/optimize_step.py,sha256= | 
| 107 | 
            +
            qadence/ml_tools/data.py,sha256=8ZUFjhQSp94w7icX7RzM2J39Yo7P_T-AgjcThBc8miI,4283
         | 
| 108 | 
            +
            qadence/ml_tools/models.py,sha256=-9XOmMRXQDI5fAjlrqlSGI7vCV3DKJVmRdngu98QroM,12476
         | 
| 109 | 
            +
            qadence/ml_tools/optimize_step.py,sha256=ATXWmAqybJVK3QmAaDqVXB5mxjTo2MIi_e0a5WSPFpc,1800
         | 
| 109 110 | 
             
            qadence/ml_tools/parameters.py,sha256=gew2Kq_5-RgRpaTvs8eauVhgo0sTqqDQEV6WHFEiLGM,1301
         | 
| 110 111 | 
             
            qadence/ml_tools/printing.py,sha256=kwwD9yLVqezaqWX5OAsXr8GLdJUnGrY-t5SnoKHtl9g,707
         | 
| 111 112 | 
             
            qadence/ml_tools/saveload.py,sha256=Xi3o2bMsYueFPxrU6AXgDB0MHSev8gKLVhdqecPDBt8,4663
         | 
| 112 113 | 
             
            qadence/ml_tools/tensors.py,sha256=xZ9ZRzOqEaMgLUGWQf1najDmL6iLuN1ojCGVFs1Tm94,1337
         | 
| 113 | 
            -
            qadence/ml_tools/train_grad.py,sha256= | 
| 114 | 
            +
            qadence/ml_tools/train_grad.py,sha256=zNzkgK73OtIllc8JLTqaM8P9m233BGa116HelsQBQqU,7727
         | 
| 114 115 | 
             
            qadence/ml_tools/train_no_grad.py,sha256=erwus-pUOg8q6WgoQsDW6MeH80wlRPBh69W1ZMHKoL8,4714
         | 
| 115 116 | 
             
            qadence/ml_tools/utils.py,sha256=_GZSN5Flk1nRFutkXih397Q3cWKdX0UP8c9CRXpUL7c,1654
         | 
| 116 117 | 
             
            qadence/models/__init__.py,sha256=0nZzAC2TGr8Yuf40-R7m2cSsr_BlNq_GsMOwaOYZLqM,193
         | 
| 117 118 | 
             
            qadence/models/qnn.py,sha256=gc_iC1GG6WJbeLaln9jy4yYp9fY0p8fkpKkKJpXJ3ck,10397
         | 
| 118 | 
            -
            qadence/models/quantum_model.py,sha256= | 
| 119 | 
            +
            qadence/models/quantum_model.py,sha256=SetO2TPd9pe2QcNCcfdHKtGM1Rj-bhCTOsaExq7smnY,14186
         | 
| 119 120 | 
             
            qadence/noise/__init__.py,sha256=r0nR8uEZeB1M9pI2UisjWq0bjw50fPFfVGzIMev923g,147
         | 
| 120 121 | 
             
            qadence/noise/protocols.py,sha256=-aZ06JvMnpxCeT5v5lI_RNPOLbb9Ju1Pi1AB6uAXxVE,1653
         | 
| 121 122 | 
             
            qadence/noise/readout.py,sha256=BqBIZbPXWqZaKi6EpBSpXXQ9NhQXdQ-YL6ZmwbSjgfE,6736
         | 
| @@ -133,7 +134,7 @@ qadence/transpile/digitalize.py,sha256=iWRwYAYQsD2INHj0HNbGJriv_3fRCuBW1nDBrwtKS | |
| 133 134 | 
             
            qadence/transpile/flatten.py,sha256=EdhSG5WyF56nbnxINNLqrHgY84MRM1YFjT3fR4aph5Q,3427
         | 
| 134 135 | 
             
            qadence/transpile/invert.py,sha256=KAefHTG2AWr39aengVhXrzCtJPhrZC-ZnL6vYvmbnY0,4867
         | 
| 135 136 | 
             
            qadence/transpile/transpile.py,sha256=6MRRkk1OS279L1fwUQjazA6qlfpbd-T_EJMKT8hAhOU,2721
         | 
| 136 | 
            -
            qadence-1. | 
| 137 | 
            -
            qadence-1. | 
| 138 | 
            -
            qadence-1. | 
| 139 | 
            -
            qadence-1. | 
| 137 | 
            +
            qadence-1.5.1.dist-info/METADATA,sha256=yM1L8J2RKy1j3WW8YnA7wZ2k8U3sIiN7wedQq__IIKM,8997
         | 
| 138 | 
            +
            qadence-1.5.1.dist-info/WHEEL,sha256=as-1oFTWSeWBgyzh0O_qF439xqBe6AbBgt4MfYe5zwY,87
         | 
| 139 | 
            +
            qadence-1.5.1.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
         | 
| 140 | 
            +
            qadence-1.5.1.dist-info/RECORD,,
         | 
| 
            File without changes
         |