-
Notifications
You must be signed in to change notification settings - Fork 21
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
[Differentiability, Refactoring] Rethink parameter dictionaries in backends / Introduce hybrid differentiation modes #255
Comments
If I understand correctly, then the problem is that |
yes great idea, but i would try to avoid changing the low-level interface so i would be inclined to keep the next question: do we want to give the user the option to choose which diff_mode to use for a particular part of the model? |
If I remember correctly, I originally designed this with @awennersteen. Indeed we didn't consider fixing some parameters, and having different grad backends. There's two options, both without changing the API, I think:
|
I, like @GJBoth, have no recollection of why we did this and what we may have considered or not :p Since @nmheim was asking about My only concern is how this might behave together with the idea of different diff-modes for different parts? But maybe this is the best way of achieving that too? |
Issue:
Right now, when we do:
we store all of the following in the initial
params
dict:(a) all variational user-facing parameters of the circuit AND observable
(b) all fixed parameters in both circuit AND observable
Issue 1: when using torch, the (torch-based) backend then knows for which params to compute gradients via the
requires_grad
flag. however, this doesnt work for JAX.issue 2: both diff_modes ADJOINT and GPSR do not support parametric observables
Possible Solution:
Introduce separate parameter dicts for initial fixed and vparams in both circuit and observable:
initial_params = {'circuit_vparams': ..., 'circuit_fixedparams': ..., 'obs_vparams': ..., 'obs_fixedparams': ..., }
The text was updated successfully, but these errors were encountered: