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

Add support for JIT when using DiagonalQubitUnitary #2445

Merged
merged 3 commits into from
Apr 14, 2022

Conversation

josh146
Copy link
Member

@josh146 josh146 commented Apr 14, 2022

Context: Due to a unitarity check, qml.DiagonalQubitUnitary did not work with @jax.jit and @tf.function.

Description of the Change: Uses qml.math.is_abstract to avoid the unitarity check if a JIT is detected.

Benefits: The operation now works with JIT compilation.

Possible Drawbacks: TensorFlow is very slow to compile, so the test added to ensure that @tf.function works takes 12 seconds :( Should we remove it?

Related GitHub Issues: n/a

@josh146 josh146 added bug 🐛 Something isn't working review-ready 👌 PRs which are ready for review by someone from the core team. labels Apr 14, 2022
@josh146 josh146 requested a review from antalszava April 14, 2022 00:02
@codecov
Copy link

codecov bot commented Apr 14, 2022

Codecov Report

Merging #2445 (dc6a107) into master (a64c204) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #2445   +/-   ##
=======================================
  Coverage   99.46%   99.46%           
=======================================
  Files         242      242           
  Lines       19104    19104           
=======================================
  Hits        19002    19002           
  Misses        102      102           
Impacted Files Coverage Δ
pennylane/ops/qubit/matrix_ops.py 99.12% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a64c204...dc6a107. Read the comment docs.

Copy link
Contributor

@antalszava antalszava 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! 🎉 😍

tests/ops/qubit/test_matrix_ops.py Show resolved Hide resolved
@josh146 josh146 merged commit eb18906 into master Apr 14, 2022
@josh146 josh146 deleted the diagonal_unitary_jax branch April 14, 2022 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working review-ready 👌 PRs which are ready for review by someone from the core team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants