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

Capture a qnode into jaxpr #5708

Merged
merged 109 commits into from
Jun 3, 2024
Merged

Capture a qnode into jaxpr #5708

merged 109 commits into from
Jun 3, 2024

Conversation

albi3ro
Copy link
Contributor

@albi3ro albi3ro commented May 17, 2024

Context:

Description of the Change:

Benefits:

Possible Drawbacks:

Related GitHub Issues:

[sc-61301]

albi3ro and others added 30 commits April 12, 2024 14:33
Co-authored-by: David Wierichs <david.wierichs@xanadu.ai>
Co-authored-by: David Wierichs <david.wierichs@xanadu.ai>
Co-authored-by: Thomas R. Bromley <49409390+trbromley@users.noreply.github.com>
@albi3ro albi3ro marked this pull request as ready for review May 28, 2024 20:09
Copy link

codecov bot commented May 28, 2024

Codecov Report

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

Project coverage is 99.66%. Comparing base (92ce59d) to head (aab3442).
Report is 259 commits behind head on master.

Files with missing lines Patch % Lines
pennylane/capture/capture_qnode.py 98.18% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5708      +/-   ##
==========================================
- Coverage   99.67%   99.66%   -0.01%     
==========================================
  Files         413      414       +1     
  Lines       39250    39017     -233     
==========================================
- Hits        39123    38887     -236     
- Misses        127      130       +3     

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

@albi3ro albi3ro requested review from dwierichs and dime10 May 28, 2024 21:58
Copy link
Contributor

@dwierichs dwierichs left a comment

Choose a reason for hiding this comment

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

Nice work in those tests @albi3ro
Excited that this integration requires so little effort 🎉

We could think about modifying the printing of qnode jaxprs in a future PR, to enhance readability :)

The names of existing files suggests to rename the new file to tests/capture/test_qnode.py 🙃

doc/releases/changelog-dev.md Outdated Show resolved Hide resolved
pennylane/capture/capture_qnode.py Outdated Show resolved Hide resolved
pennylane/capture/capture_qnode.py Show resolved Hide resolved
pennylane/capture/capture_qnode.py Outdated Show resolved Hide resolved
pennylane/capture/capture_qnode.py Outdated Show resolved Hide resolved
tests/capture/test_capture_qnode.py Show resolved Hide resolved
tests/capture/test_capture_qnode.py Show resolved Hide resolved
tests/capture/test_capture_qnode.py Show resolved Hide resolved
tests/capture/test_capture_qnode.py Outdated Show resolved Hide resolved
tests/capture/test_capture_qnode.py Show resolved Hide resolved
albi3ro and others added 2 commits May 29, 2024 11:29
Copy link
Contributor

@dime10 dime10 left a comment

Choose a reason for hiding this comment

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

Love it, this looks great 💯

Base automatically changed from plxpr-capture-measurements to master May 30, 2024 01:14
@albi3ro albi3ro requested a review from dwierichs May 31, 2024 15:33
Copy link
Contributor

@dwierichs dwierichs left a comment

Choose a reason for hiding this comment

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

Thanks @albi3ro, looking forward to this going in!

I'm approving, conditioned on a conscious decision about obtaining the shots in the beginning of qnode_call: Should we always call _get_device_shots, and cast to a Shots object even if it is one already? It's not crucial, but deserves a thought, I think :)

pennylane/capture/capture_qnode.py Outdated Show resolved Hide resolved
tests/capture/test_capture_qnode.py Show resolved Hide resolved
tests/capture/test_capture_qnode.py Show resolved Hide resolved
tests/capture/test_capture_qnode.py Show resolved Hide resolved
tests/capture/test_capture_qnode.py Outdated Show resolved Hide resolved
pennylane/capture/capture_qnode.py Show resolved Hide resolved
albi3ro and others added 4 commits June 3, 2024 09:31
Co-authored-by: David Wierichs <david.wierichs@xanadu.ai>
Co-authored-by: David Wierichs <david.wierichs@xanadu.ai>
@albi3ro albi3ro enabled auto-merge (squash) June 3, 2024 13:57
@albi3ro albi3ro merged commit b797b1d into master Jun 3, 2024
39 of 40 checks passed
@albi3ro albi3ro deleted the capture-qnode branch June 3, 2024 14:02
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.

3 participants