-
Notifications
You must be signed in to change notification settings - Fork 60
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
Measurement fixes #325
Measurement fixes #325
Conversation
Codecov Report
@@ Coverage Diff @@
## master #325 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 74 76 +2
Lines 12082 12292 +210
==========================================
+ Hits 12082 12292 +210
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Thanks for this, looks good. Seems to fix the numpy issues I have observed with master. However, for my example (carlos code) on CPU, I observe that the numpy_defaulteinsum backend seems 2x faster than tf custom. Did you observe something similar? |
Thanks for checking. I believe there is an issue with performance due to the way the tensor of frequencies is transformed to a dictionary, especially with Tensorflow where this line contains exponentially many castings to Python int. This is more visible if you try more qubits, eg. for 20 in my notebook numpy works but tf actually fails. The current frequency calculation is more like a placeholder though, I will try to implement something close to what Carlos suggested in #322 which should also include the noise, so I would check again the final performance once we have this version. |
Great, thanks for the checks. |
Add nshot switcher
Speeding up Metropolis for frequency
Metropolis algorithm for sampling shots
Implements the following:
tests/test_measurements.py
totests_new/test_measurement_gate.py
,test_measurement_gate_probabilistic.py
andtest_measurement_gate_registers.py
. Now these tests are also done using the numpy backends (fixes measurements for numpy backend #321?).I have not made any changes in the code in order to support numpy, however the following script works both when only numpy is installed (no Tensorflow) and when both numpy and Tensorflow are installed:
Note that your results may be difference due to randomness. @scarrazza, if you have spotted a different issue with measurements in numpy that still exists, please let me know.
will work and return
Counter({'00': 2500000000, '01': 2500000000, '10': 2500000000, '11': 2500000000})
, whileresult.samples()
will fail with OOM as before.TODO:
GateResult
,CircuitResult
incore.measurements
are a bit obscure in terms of code readability and I would rename them to something else, such asMeasurementResult
andMeasurementRegisterResult
.test_core_measurements.py