-
Notifications
You must be signed in to change notification settings - Fork 706
Refactor symbolic resource decomposition methods for resource estimation #8641
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
base: fix_custom_decomp
Are you sure you want to change the base?
Conversation
|
Hello. You may have forgotten to update the changelog!
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## fix_custom_decomp #8641 +/- ##
====================================================
Coverage ? 99.43%
====================================================
Files ? 587
Lines ? 61987
Branches ? 0
====================================================
Hits ? 61634
Misses ? 353
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ddhawan11
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @austingmhuang. I think we should also add tests to make sure that the bug is fixed.
| * The `_get_decomposition` and `_update_counts_from_compressed_op` methods in `pennylane/estimator/estimate.py` were updated to directly call the base class's `symbolic_resource_decomp` method, simplifying the decomposition pipeline. | ||
| [(#8641)](https://github.com/PennyLaneAI/pennylane/pull/8641) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please limit this to 100 characters.
Co-authored-by: Diksha Dhawan <[email protected]>
Context:
In pennylane/estimator/estimate.py, when we call
_update_counts_from_compressed_op, we get our decomposition function using_get_decomposition, which returns the symbolic class'sresource_decompmethod. Rather than use that, we should to "cut out the middle man" -- instead of pointing to the symbolic'sresource_decompmethod, and having that point to the base class'ssymbolic_resource_decompmethod, we can just point directly to the base class'ssymbolic_resource_decompmethod.Description of the Change:
Update
_get_decompositionand_update_counts_from_compressed_opinpennylane/estimator/estimate.pyto just call the base class's symbolic resource decomp method with the appropriate params and kwargs.Now fully supports this UI:
Benefits:
Simplifies the pipeline, improving readability and maintainability.
Possible Drawbacks:
The symbolic classes resource decomp method remains, which can be a source of confusion. A set of code comments is provided.
Related GitHub Issues:
[sc-103387]
[sc-103956]