PennyLaneAI / pennylane

PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
https://pennylane.ai
Apache License 2.0
2.17k stars 568 forks source link

Minor program capture fixes #5889

Closed albi3ro closed 1 week ago

albi3ro commented 1 week ago

Context:

Catalyst PR #837 (https://github.com/PennyLaneAI/catalyst/pull/837) needs a couple minor updates to the capture module.

Description of the Change:

1) makes it possible to do from pennylane.capture import AbstractOperator, AbstractMeasurement, qnode_prim so we don't have to touch private functions

2) Adds qnode as a keyword argument that gets bound to the qnode primitive

3) Makes it so we can capture a sample measurement specified like qml.sample(wires=1)

Benefits:

Possible Drawbacks:

Related GitHub Issues: [sc-66703]

github-actions[bot] commented 1 week ago

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

albi3ro commented 1 week ago

Thanks @albi3ro, LGTM! May I ask to add the PR to the changelog entry for the capture effort?

changelog link added.

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.66%. Comparing base (8fec135) to head (a2fcde0). Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #5889 +/- ## ========================================== - Coverage 99.67% 99.66% -0.01% ========================================== Files 422 425 +3 Lines 40651 40455 -196 ========================================== - Hits 40518 40321 -197 - Misses 133 134 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.