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

LightningQubit VJP support #644

Merged
merged 21 commits into from
Apr 4, 2024
Merged

LightningQubit VJP support #644

merged 21 commits into from
Apr 4, 2024

Conversation

mudit2812
Copy link
Contributor

@mudit2812 mudit2812 commented Mar 15, 2024

Context:
This PR adds adjoint VJP computation support to lightning.qubit with the new API.

Description of the Change:

  • Add LightningQubit.compute_vjp, supports_vjp, and execute_and_compute_vjp methods along with appropriate helper functions.
  • Update tests/test_vjp.py to stop skipping new API devices.
  • Add new tests to tests/new_api/test_device.py.

Benefits:

  • QNodes using LightningQubit can now set the device_vjp argument to automatically use the VJP pipeline for differentiation.

Possible Drawbacks:

Related GitHub Issues:

@mudit2812 mudit2812 marked this pull request as draft March 15, 2024 15:36
@mudit2812
Copy link
Contributor Author

[sc-59045]

Base automatically changed from lightning-qubit2-interface to master March 15, 2024 21:05
Copy link

codecov bot commented Mar 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.66%. Comparing base (0d3ae45) to head (3d1905a).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #644      +/-   ##
==========================================
+ Coverage   98.39%   98.66%   +0.27%     
==========================================
  Files         172      172              
  Lines       25138    24376     -762     
==========================================
- Hits        24734    24051     -683     
+ Misses        404      325      -79     

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

@mudit2812
Copy link
Contributor Author

Lots of test failures in Pennylane due to lack of VJP support in Lightning. I am skipping such tests for now, but they should stop being skipped once this PR is merged. See the files changed in PL #5434 to find which tests need to be updated.

@AmintorDusko AmintorDusko changed the title LightningQubit2 VJP support LightningQubit VJP support Mar 22, 2024
@mudit2812 mudit2812 marked this pull request as ready for review April 2, 2024 21:18
@mudit2812
Copy link
Contributor Author

TODO in pennylane: Uncomment interface tests using lightning.qubit with device_vjp=True. These were commented out due to LightningQubit not being able to compute VJPs.

@AmintorDusko AmintorDusko added the ci:build_wheels Activate wheel building. label Apr 3, 2024
Copy link
Contributor

@AmintorDusko AmintorDusko left a comment

Choose a reason for hiding this comment

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

Nice job! Thanks!

@AmintorDusko AmintorDusko requested a review from a team April 4, 2024 14:30
@vincentmr vincentmr self-requested a review April 4, 2024 14:50
Copy link
Contributor

@vincentmr vincentmr left a comment

Choose a reason for hiding this comment

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

Looks good to me, nice work @mudit2812 !

@mudit2812 mudit2812 merged commit c3fefb2 into master Apr 4, 2024
85 checks passed
@mudit2812 mudit2812 deleted the lq2-vjp branch April 4, 2024 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:build_wheels Activate wheel building.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants