tensorflow / quantum

Hybrid Quantum-Classical Machine Learning in TensorFlow
https://www.tensorflow.org/quantum
Apache License 2.0
1.77k stars 558 forks source link

[Discussion] Gradient of state op #420

Open MichaelBroughton opened 3 years ago

MichaelBroughton commented 3 years ago

It was pointed out in #256 by @refraction-ray that once we had implemented the adjoint differentiation scheme, it might be possible for us to make our calculate_state op differentiable as well. Though initially we felt that giving people too many powerful tools outside of what is actually possible on a true QC was not the best idea, I feel like since we are catering towards more expert users adding this feature will be fine (since experts will know you can't differentiate through a whole state or calculate a whole state when running on a NiSQ chip).

@refraction-ray do you have any more inputs on implementation that you would like to share ?

@zaqqwerty and @jaeyoo how do you feel about allowing for state vectors to be differentiable ?

zaqqwerty commented 3 years ago

Seems like a differentiable state simulator is something people want, if we don't do it in TFQ people might go elsewhere for it. Having it under the TFQ umbrella, we can also ensure it will be performant enough.

refraction-ray commented 3 years ago

I have no new inputs on the implementation since it seems to be the same as before in terms of adjoint differentiation.

A comment on the gauge redundancy/overall phase ambiguity of the wavefunction: one doesn't need to concern about such ambiguity when implementing AD; the point is, as long as the final objective is gauge invariant in terms of the overall phase of final quantum state (which should be the case for any physics meaningful quantities), the result of the gradient against the objective will have no ambiguity.