-
-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LRE failure for chunking #2608
base: main
Are you sure you want to change the base?
LRE failure for chunking #2608
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2608 +/- ##
=======================================
Coverage 98.73% 98.74%
=======================================
Files 92 93 +1
Lines 4193 4219 +26
=======================================
+ Hits 4140 4166 +26
Misses 53 53 ☔ View full report in Codecov by Sentry. |
Converting this back to draft because @natestemen suggested to write a better test. |
mitiq/lre/tests/test_lre.py
Outdated
assert abs(lre_exp_val - ideal_val) <= abs(noisy_val - ideal_val) | ||
# verify we get an expectation value | ||
assert(lre_exp_val_chunking) > 0 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@natestemen I cannot think of a better test here. Which is why I decided to check the function does provided a non-zero expectation value.
test_layerwise_folding
already has a test comparing the number of noise-scaled layers for a chunked and a non-chunked circuit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would argue that this test is unnecessary.
We already have tests that ensure that chunking works as expected (here, and here). The only thing this test could be doing (aside from asserting accuracy) is testing the number of circuits run is as expected, but this would be redundant from the above linked tests.
Should we remove it. WDYT?
This test is verifying the executor works with chunking without any issues. I prefer to keep it. |
Okay, but we need to define this more specifically. If we know that the LRE config (with chunking) generates |
that the lre executor takes |
Ah okay that's right! In that case, I think it should be sufficient to mock the executor, and ensure that it is run the correct number of times. |
Done! |
Description
Noticed in #2601
https://github.com/unitaryfund/mitiq/actions/runs/12433520415/job/34715234002?pr=2601#step:6:4591
Originally, the test was written to confirm chunking a circuit performs worse in certain scenarios. However, this performance varies non-deterministically. Due to this reason, now the test is verifying there is a difference between two expectation values.
License
Before opening the PR, please ensure you have completed the following where appropriate.