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

Allow abstract Boolean measurement results as a parameter to qml.sample #5673

Merged
merged 7 commits into from
May 24, 2024

Conversation

dime10
Copy link
Contributor

@dime10 dime10 commented May 8, 2024

This PR allows qml.sample (and implicitly other measurement processes) to accept a Boolean tracer in the observable parameter, similar to what is already done for the MeasurementValue value object. The wires attribute will be empty in this case.

[sc-62096]

Copy link
Contributor

github-actions bot commented May 8, 2024

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md 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.

Copy link

codecov bot commented May 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.67%. Comparing base (58668d7) to head (46ca9fa).
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5673      +/-   ##
==========================================
- Coverage   99.68%   99.67%   -0.01%     
==========================================
  Files         416      416              
  Lines       39049    38812     -237     
==========================================
- Hits        38925    38687     -238     
- Misses        124      125       +1     

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

@trbromley
Copy link
Contributor

Thanks @dime10! Would you mind linking the associated SC story?

@dime10
Copy link
Contributor Author

dime10 commented May 10, 2024

Thanks @dime10! Would you mind linking the associated SC story?

Sure thing! This is just one possible way forward for the following story:
[sc-62096]

Copy link
Contributor

@mudit2812 mudit2812 left a comment

Choose a reason for hiding this comment

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

I'm on board with these changes. Will approve after tests are added.

@dime10 dime10 marked this pull request as ready for review May 10, 2024 21:50
@dime10 dime10 changed the title Allow wires and observable parameter when tracing Allow abstract Boolean measurement results as a parameter to qml.sample May 10, 2024
@dime10 dime10 enabled auto-merge (squash) May 24, 2024 17:14
@dime10 dime10 merged commit fbc2a39 into master May 24, 2024
40 checks passed
@dime10 dime10 deleted the sample-mcm branch May 24, 2024 17:15
dime10 added a commit to PennyLaneAI/catalyst that referenced this pull request May 27, 2024
This PR can be merged after
PennyLaneAI/pennylane#5673.

Introduce support for `m = measure(0); qml.sample(m)` in Catalyst
programs. In conjunction with ongoing work on MCM support, this will
allow returning `shots` number of MCM samples from a quantum program.

[sc-62096]
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.

None yet

4 participants