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

Unify error message for better Catalyst support #577

Merged
merged 22 commits into from
Dec 14, 2023

Conversation

multiphaseCFD
Copy link
Member

@multiphaseCFD multiphaseCFD commented Dec 13, 2023

Before submitting

Please complete the following checklist when submitting a PR:

  • All new features must include a unit test.
    If you've fixed a bug or added code that should be tested, add a test to the
    tests directory!

  • All new functions and code must be clearly commented and documented.
    If you do make documentation changes, make sure that the docs build and
    render correctly by running make docs.

  • Ensure that the test suite passes, by running make test.

  • Add a new entry to the .github/CHANGELOG.md file, summarizing the
    change, and including a link back to the PR.

  • Ensure that code is properly formatted by running make format.

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.


Context:

Unify error messages of shot measurement related unsupported observables to better Catalyst.

Description of the Change:

For the moment, shot measurements support Paulis, Identity and Hadamard obs and TensorProd/Hamiltonian obs created based on above mentioned named obs. Error messages are thrown inside each shot measurement method. Now error messages are obs based and it will support Catalyst better.

Benefits:

Possible Drawbacks:

Related GitHub Issues:

@multiphaseCFD multiphaseCFD added the ci:use-multi-gpu-runner Enable usage of Multi-GPU runner for this Pull Request label Dec 13, 2023
Copy link

codecov bot commented Dec 13, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (998362a) 98.95% compared to head (d9d304d) 98.68%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #577      +/-   ##
==========================================
- Coverage   98.95%   98.68%   -0.28%     
==========================================
  Files         167      167              
  Lines       24382    23959     -423     
==========================================
- Hits        24128    23644     -484     
- Misses        254      315      +61     

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

@multiphaseCFD multiphaseCFD marked this pull request as ready for review December 13, 2023 02:25
@AmintorDusko
Copy link
Contributor

@multiphaseCFD, could you please fill-out the PR description?

@multiphaseCFD
Copy link
Member Author

@multiphaseCFD, could you please fill-out the PR description?

Thanks @AmintorDusko . Done!

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, cheers @multiphaseCFD !

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 work @multiphaseCFD! Thank you for that!

@maliasadi
Copy link
Member

Hey Shuli, Would you like to include the patch to address the following issue as well?

var(TensorProd, num_shots=5000) using the C++ API in both Lightning and LightningKokkos returns zero for the following circuit:

@qml.qnode(dev)
def circuit():
    qml.PauliX(0)
    qml.PauliY(1)
    qml.Hadamard(2)
    qml.PauliZ(3)
    return qml.var(qml.PauliX(2) @ qml.PauliY(1) @ qml.PauliZ(0))

>>> circuit()
0.99983616

@multiphaseCFD
Copy link
Member Author

[565387d](/PennyLaneAI/pennylane-lightning/pull/577/commits/565387d46aa08c47e5b2d843a9e888f3e56ba266)

Hey @maliasadi , just tested the circuit you mentioned above with 565387d and tests passed in C++ backend.

@multiphaseCFD multiphaseCFD merged commit 8101e42 into master Dec 14, 2023
@multiphaseCFD multiphaseCFD deleted the unify_error_message_obs branch December 14, 2023 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:use-multi-gpu-runner Enable usage of Multi-GPU runner for this Pull Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants