Skip to content
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

Convert to samples/counts based on available MPs #1148

Merged
merged 5 commits into from
Sep 23, 2024
Merged

Conversation

lillian542
Copy link
Contributor

@lillian542 lillian542 commented Sep 20, 2024

Context:

In #1123 we changed the criteria for applying measurements_from_samples and measurements_from_counts to be based on whether or not there are supported observables. Previously the decision in preprocess had been based on supported measurement processes instead of supported observables. The reason for this change is that those transforms don't only change the measurement type - they also go a step further and diagonalize the observables to the readout basis. This is potentially a separate functionality from modifying measurement types.

There was discussion of this being handled by a future transform that is more specific to selectively transforming unsupported MPs without changing the observables. However, that isn't implemented yet, and the QRack plugin in analytic mode only supports Counts and Samples, so its needed now.

Description of the Change:
This PR reintroduces the check for supported measurement types being limited to a subset of {"Counts", "Samples"} in when adding measurement transforms to the device TransformProgram.

Benefits:
The QRack device keeps working.

Possible Drawbacks:
Depending what the backend supports, arguably the TOML file loading is what should change here - if the observables are only supported in analytic mode, then the qjit_capabilities in finite-shots mode should have an empty list of observables, and then this change would be unnecessary. So maybe I'm not fixing this in the most logical place? But I'm not sure about that, and I'm sure this will work.

Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md on your branch with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@rmoyard rmoyard marked this pull request as ready for review September 23, 2024 13:26
Copy link
Contributor

@rmoyard rmoyard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick change!

Copy link

codecov bot commented Sep 23, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.88%. Comparing base (621c027) to head (13dd59b).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
frontend/catalyst/device/qjit_device.py 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1148      +/-   ##
==========================================
- Coverage   97.89%   97.88%   -0.01%     
==========================================
  Files          76       76              
  Lines       10858    10863       +5     
  Branches     1281     1283       +2     
==========================================
+ Hits        10629    10633       +4     
  Misses        179      179              
- Partials       50       51       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rmoyard rmoyard self-requested a review September 23, 2024 19:01
Copy link
Contributor

@rmoyard rmoyard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix 👍

@rmoyard rmoyard merged commit c13cd9b into main Sep 23, 2024
44 of 45 checks passed
@rmoyard rmoyard deleted the convert_unsupported_mps branch September 23, 2024 19:02
dime10 added a commit that referenced this pull request Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants