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

[Feature] Pyqtorch - First Order Adjoint Differentiation #155

Merged
merged 81 commits into from
Nov 17, 2023
Merged
Changes from 1 commit
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
351908b
Test adjoint
dominikandreasseitz Oct 30, 2023
f7c385b
Add adjoint to diff backend
dominikandreasseitz Oct 31, 2023
9a30c2e
Some edits
dominikandreasseitz Oct 31, 2023
800c325
Rework with DiffBknd
dominikandreasseitz Nov 1, 2023
3b10cf6
back to pyq circ
dominikandreasseitz Nov 1, 2023
eed7503
SKip tests, improve pyqobs
dominikandreasseitz Nov 1, 2023
f16a8b9
fix ops assignment
dominikandreasseitz Nov 1, 2023
095b89c
Move to new file
dominikandreasseitz Nov 1, 2023
f96f04e
grad_out
dominikandreasseitz Nov 1, 2023
c9b1591
differentiate heas tests
dominikandreasseitz Nov 1, 2023
1f2954d
introduce acceptance
dominikandreasseitz Nov 1, 2023
19a7eaa
supports adjoint
dominikandreasseitz Nov 1, 2023
4e3f7bd
fix scale
dominikandreasseitz Nov 2, 2023
3e8f41a
simplify composeblock
dominikandreasseitz Nov 2, 2023
18bda98
Refactor compose
dominikandreasseitz Nov 2, 2023
3fb7c04
More refac
dominikandreasseitz Nov 2, 2023
16cf030
refac
dominikandreasseitz Nov 2, 2023
d7fe767
New pyq hamevo
dominikandreasseitz Nov 2, 2023
e892ce8
hamevo evolve operator time evo jacobian
dominikandreasseitz Nov 2, 2023
5cf7a4a
Jacobians for hamevo evolved gens
dominikandreasseitz Nov 2, 2023
214b351
Add finitediff for hamevo grads
dominikandreasseitz Nov 3, 2023
057da24
Detach correctly
dominikandreasseitz Nov 3, 2023
4799678
New adjoint with hamevo and tests
dominikandreasseitz Nov 3, 2023
195f18d
New version
dominikandreasseitz Nov 3, 2023
a5329db
diffmode
dominikandreasseitz Nov 3, 2023
772578c
Merge branch 'main' into ds/adjoint
dominikandreasseitz Nov 3, 2023
cff8236
Skip braket adjoint
dominikandreasseitz Nov 6, 2023
9a47ed9
Deprecate grad ckpting
dominikandreasseitz Nov 6, 2023
6a09ae5
Deprecate grad ckpting
dominikandreasseitz Nov 6, 2023
35ee008
Add qnn test
dominikandreasseitz Nov 6, 2023
5e38d87
Create pyq state manipulation methods
dominikandreasseitz Nov 6, 2023
c4abd2a
Add diff tests
dominikandreasseitz Nov 6, 2023
d036c1c
correct bs
dominikandreasseitz Nov 6, 2023
0ffd420
Merge branch 'main' into ds/adjoint
dominikandreasseitz Nov 6, 2023
758877c
rm fn
dominikandreasseitz Nov 6, 2023
a1119f9
Merge branch 'main' into ds/adjoint
dominikandreasseitz Nov 7, 2023
956cc6a
Use no_grad in adjoint
dominikandreasseitz Nov 7, 2023
c2e78ae
double precision finite diff
dominikandreasseitz Nov 7, 2023
10e63f0
Higher order tests
dominikandreasseitz Nov 7, 2023
b99ba2d
Merge branch 'main' into ds/adjoint
dominikandreasseitz Nov 7, 2023
0b12287
Cleanup
dominikandreasseitz Nov 7, 2023
018b53b
add tests
dominikandreasseitz Nov 8, 2023
53031bd
Add batch_size to test
dominikandreasseitz Nov 8, 2023
808939a
Merge branch 'main' into ds/adjoint
dominikandreasseitz Nov 8, 2023
097c381
doc formatter
dominikandreasseitz Nov 8, 2023
cd6675e
Move fns to different file
dominikandreasseitz Nov 8, 2023
7075320
Fix imports
dominikandreasseitz Nov 8, 2023
d96f4a4
Merge branch 'main' into ds/adjoint
dominikandreasseitz Nov 8, 2023
4c62a38
Merge branch 'main' into ds/adjoint
dominikandreasseitz Nov 8, 2023
0fce2df
Merge branch 'main' into ds/adjoint
dominikandreasseitz Nov 9, 2023
60dadad
Merge branch 'main' into ds/adjoint
dominikandreasseitz Nov 9, 2023
d962684
Adjust
dominikandreasseitz Nov 9, 2023
5b5445b
Merge branch 'main' into ds/adjoint
dominikandreasseitz Nov 9, 2023
d3d3a25
Lint
dominikandreasseitz Nov 9, 2023
9a34456
skipping higher order test since it was only for demonstration purposes
dominikandreasseitz Nov 9, 2023
35936d7
Working version for batched and repeated params, higher order hybrid …
dominikandreasseitz Nov 14, 2023
93f8392
Merge branch 'main' into ds/adjoint
dominikandreasseitz Nov 14, 2023
1c34957
Import
dominikandreasseitz Nov 14, 2023
c8012dd
skip tests
dominikandreasseitz Nov 14, 2023
a7f2dfc
Decrease atol
dominikandreasseitz Nov 14, 2023
af61ff9
userwarning
dominikandreasseitz Nov 14, 2023
25b5035
Rename fn
dominikandreasseitz Nov 15, 2023
46fa46f
Move methods to utils
dominikandreasseitz Nov 15, 2023
982518f
Refac
dominikandreasseitz Nov 15, 2023
f8849fc
Skip higher order
dominikandreasseitz Nov 15, 2023
ef24bc5
Rename tests
dominikandreasseitz Nov 15, 2023
d85c5fc
Readd no_grad forward, add flakyness for ml_tools test_train
dominikandreasseitz Nov 15, 2023
4bffcd1
Xfail again
dominikandreasseitz Nov 16, 2023
24f7d36
Deprecated
dominikandreasseitz Nov 16, 2023
d01c32e
Braket adjoint comment
dominikandreasseitz Nov 16, 2023
02c5a1a
validate state
dominikandreasseitz Nov 16, 2023
25d2490
Check state shape
dominikandreasseitz Nov 16, 2023
ec38356
Docstrings
dominikandreasseitz Nov 16, 2023
e5db889
More docstrings
dominikandreasseitz Nov 16, 2023
e5677c5
Even more docstrings
dominikandreasseitz Nov 16, 2023
17e1195
Merge branch 'main' into ds/adjoint
dominikandreasseitz Nov 16, 2023
db19f11
Add adjoint example
dominikandreasseitz Nov 16, 2023
78f063f
Docstring for adjoint, restrict jacobian for hamevo generators
dominikandreasseitz Nov 16, 2023
bacef43
Merge branch 'main' into ds/adjoint
dominikandreasseitz Nov 17, 2023
7d05445
Merge branch 'main' into ds/adjoint
dominikandreasseitz Nov 17, 2023
1cd6e34
Handle case of both time and gen parameters in adjoint
dominikandreasseitz Nov 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Handle case of both time and gen parameters in adjoint
dominikandreasseitz committed Nov 17, 2023
commit 1cd6e341c9945a47b2b01bb4af243a57de53435f
2 changes: 1 addition & 1 deletion qadence/backends/adjoint.py
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ def _apply_adjoint(ctx: Any, op: Module) -> list:
ctx.out_state, op.jacobian_generator(values), op.qubit_support
)
grads.append(2 * overlap(ctx.projected_state, mu))
elif time_param.requires_grad:
if time_param.requires_grad:
# If the time evolution is trainable, we compute its gradient.
mu = apply_operator(ctx.out_state, op.jacobian_time(values), op.qubit_support)
grads.append(2 * overlap(ctx.projected_state, mu))