-
Notifications
You must be signed in to change notification settings - Fork 558
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
Support for Hermitian observables when used with qml.shadow_expval() #5567
Comments
Hi @poojithumeshrao, thank you for opening this bug report! A Unfortunately it doesn't look like an easy fix from PennyLane's side but we will indeed improve the error message to make it easier to understand what's going on. On the other hand we noticed that you're using PennyLane v0.32. If possible my recommendation would be to upgrade to the latest version. We will make a new release in two weeks so you can update your version now and again in two weeks to smooth out any possible issues. If you want to learn more about classical shadows feel free to take a look at this demo. |
Hi, @CatalinaAlbornoz, thank you for the timely response. After going through the traceback, I was able to make it work (at least in my case) by manually decomposing the Hermitian matrix using qml.pauli_decompose(). The modified code is as follows:
I am not sure if it works generally, but I thought it would also be useful for you. |
Ah this is great! Thank you for sharing it @poojithumeshrao . |
Hi @poojithumeshrao! Thanks for posting this. I tweaked the title of this issue to reflect that we still have a valid feature request to eventually take care of, i.e., support for |
Expected behavior
When the expectation value of a Hermitian observable is measured using qml.shadow_expval(), a float value has to be returned. Ideally, it must return a value close to qml.expval().
Actual behavior
"'NoneType' object is not iterable" error is thrown instead.
Additional information
No response
Source code
Tracebacks
System information
Existing GitHub issues
The text was updated successfully, but these errors were encountered: