Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
VQECost can optimize observables using the grouping module #902
VQECost can optimize observables using the grouping module #902
Changes from 26 commits
77c148e
ebfae27
941d74c
7e66a3c
060246b
b18692f
0e032d7
6d5ca5b
932a137
a1bf995
8b01f8e
f194e84
cc863c7
69ec783
9b1ab3c
b2e896e
06d9cc3
10ff143
63b6fea
8b0df6f
9b56875
dd688c3
18526ad
c35e3a5
f7a3f44
e18be4d
9b766bc
ed2d6d6
923a262
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Hey @trbromley, I thought about this more, and I don't see why it shouldn't work in practice. The Fubini-Study metric tensor is independent of the variational circuit measured observables --- it only depends on the circuit ansatz.
So what we could do here:
qnode.metric_tensor(args=args, kwargs=kwargs, diag_approx=diag_approx)
.As long as PennyLane lets us freely mix tape mode and non-tape mode, this should work and be very simple to code up.
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.
Note: this is a short term fix:
It is not trivial to support QNG in tape mode, so likely this can't be done over the next few days
However, if using VQECost, we could behind-the-scenes simply uses non-tape mode for the Fubini-Study metric tensor, and tape mode for the cost function and gradients.
The longer term fix would be to support the metric tensor calculation in tape mode
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.
Good idea, I'm having a go in this branch but having some troubles: https://github.com/PennyLaneAI/pennylane/tree/ch2397-metric
I think we should merge this in now and follow up if we can get metric tensor support.