Skip to content

Commit

Permalink
Merge pull request #630 from qiboteam/tspatol
Browse files Browse the repository at this point in the history
Add atol in TSP test
  • Loading branch information
scarrazza committed Aug 5, 2022
2 parents 147d868 + 771bc35 commit 40802bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/qibo/tests/test_models_tsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def qaoa_function_of_layer(backend, layer):
def test_tsp(backend, nlayers):
final_state = backend.to_numpy(qaoa_function_of_layer(backend, nlayers))
assert_regression_fixture(
backend, final_state.real, f"tsp_layer{nlayers}_real.out", rtol=1e-3
backend, final_state.real, f"tsp_layer{nlayers}_real.out", rtol=1e-3, atol=1e-5
)
assert_regression_fixture(
backend, final_state.imag, f"tsp_layer{nlayers}_imag.out", rtol=1e-3
backend, final_state.imag, f"tsp_layer{nlayers}_imag.out", rtol=1e-3, atol=1e-5
)
4 changes: 2 additions & 2 deletions src/qibo/tests/test_models_variational.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
REGRESSION_FOLDER = pathlib.Path(__file__).with_name("regressions")


def assert_regression_fixture(backend, array, filename, rtol=1e-5):
def assert_regression_fixture(backend, array, filename, rtol=1e-5, atol=1e-12):
"""Check array matches data inside filename.
Args:
Expand All @@ -34,7 +34,7 @@ def load(filename):
# case not tested in GitHub workflows because files exist
np.savetxt(filename, array)
array_fixture = load(filename)
backend.assert_allclose(array, array_fixture, rtol=rtol)
backend.assert_allclose(array, array_fixture, rtol=rtol, atol=atol)


test_names = "method,options,compile,filename"
Expand Down

0 comments on commit 40802bd

Please sign in to comment.