-
Notifications
You must be signed in to change notification settings - Fork 644
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
[Bug Fix] Fix TrotterProduct
to be compatible with resource tracking and error tracking
#5629
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## v0.36.0-rc0 #5629 +/- ##
==============================================
Coverage ? 99.69%
==============================================
Files ? 412
Lines ? 38352
Branches ? 0
==============================================
Hits ? 38234
Misses ? 118
Partials ? 0 ☔ View full report in Codecov by Sentry. |
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 @Jaybsoni, looks good to go.
Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com>
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 @Jaybsoni, please split the PR. Thanks.
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 @Jaybsoni! Leaving a query and couple of suggestions.
num_wires = len(self.wires) | ||
num_gates = len(decomp) | ||
|
||
unique_operation_decomp = (copy.deepcopy(op) for op in decomp) |
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.
I am assuming you want to deep copy this to use it in the tape below? Is that true? Wouldn't it give us a performance hit? 🤔
Also, this is a generator
right and not set
, so the decomposition need not be unique.
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.
The problem with the existing decomposition of TrotterProduct, is that it reuses the same operators (with qml.apply). The unique_operation_decomp
generator is required to make a new copy of each operator in the decomposition.
Co-authored-by: Utkarsh <utkarshazad98@gmail.com>
As discussed in our standup meeting today, this PR is not expected to be included in the v0.36 release. Can we rebase the PR to the master branch? @Jaybsoni @trbromley |
It's not very complicated, I can just re-create the PR. Sorry for the delayed response. |
**Context:** `qml.TrotterProduct()` now has error tracking functionality, but ins't compatible with resource tracking. This bug fix adds native resource tracking functionality to allow for compatibility with both pipelines.  **Description of the Change:** Inherit from `ResourcesOperation` class as well and directly implement the resource method. **Benefits:** Allows for tracking resources without decomposing the template. **Possible Drawbacks:** If we change the target gate-set or want to decompose further, then this method is no longer accurate. **Related GitHub Issues:** Replicating most of this [PR](#5629) post release. --------- Co-authored-by: Utkarsh <utkarshazad98@gmail.com>
Context:
qml.TrotterProduct()
now has error tracking functionality, but ins't compatible with resource tracking. This bug fix adds native resource tracking functionality to allow for compatibility with both pipelines.Description of the Change:
Inherit from
ResourcesOperation
class as well and directly implement the resource method.Benefits:
Allows for tracking resources without decomposing the template.
Possible Drawbacks:
If we change the target gate-set or want to decompose further, then this method is no longer accurate.
Related GitHub Issues: