Skip to content

Commit

Permalink
tests: adapt interfaces tests to analytical as property
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoRobbiati committed Nov 7, 2024
1 parent d279f13 commit 5ae1ade
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tests/test_models_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,14 @@ def test_encoding(backend, frontend, layer, seed):


@pytest.mark.parametrize("layer,seed", zip(DECODING_LAYERS, [1, 2, 1, 1]))
@pytest.mark.parametrize("analytic", [True, False])
def test_decoding(backend, frontend, layer, seed, analytic):
def test_decoding(backend, frontend, layer, seed):
if frontend.__name__ == "qiboml.interfaces.keras":
pytest.skip("keras interface not ready.")
if backend.name not in ("pytorch", "jax"):
pytest.skip("Non pytorch/jax differentiation is not working yet.")
if analytic and not layer is dec.Expectation:
if layer.analytic and not layer is dec.Expectation:
pytest.skip("Unused analytic argument.")
if not analytic and not layer is dec.Expectation:
if not layer.analytic and not layer is dec.Expectation:
pytest.skip(
"Expectation layer is the only differentiable decoding when the diffrule is not analytical."
)
Expand All @@ -255,8 +254,7 @@ def test_decoding(backend, frontend, layer, seed, analytic):
backend=backend,
)
kwargs["observable"] = observable
kwargs["analytic"] = analytic
if not analytic:
if not layer.analytic:
differentiation_rule = PSR()
else:
differentiation_rule = None
Expand Down

0 comments on commit 5ae1ade

Please sign in to comment.