-
Notifications
You must be signed in to change notification settings - Fork 192
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
Add threshold detector measurements to frontend & backends #134
Comments
I would propose This allows the backends to implement this differently to |
I agree with Josh --- Mostly what is needed is some frontend operation and a way to communicate this to the backend. Ideally, for the Fock backends it should be not too hard to also construct conditional states after |
Yep, only blocker I foresee here is (as usual), the TF backend, which has to implement all operations using tf ops |
Does the TF backend have operations for partial trace and postselection on vacuum? If so, conditional states after successful |
I was thinking more that actually implementing the sampling would be the harder part (since we can't just call hafnian lib) |
I think all the pieces are there and there is very minimal coding needed since the Fock backends already know about probabilities in the Fock basis. |
Hi there!!! I'm trying to run some simulations using SF with TensorFlow backend and it would be really helpful to have a MeasureThreshold function with this backend. I have also tried to switch to Fock or Gaussian (1 shot) but it does not seem to be defined. I would be especially interested in manipulating the post-measurement state. |
Hi @MattRos90 Thanks for your feedback. To help us distill what you're looking for, I have a couple questions: Are you looking to carry out threshold measurements specifically with the TF backend, or would any backend do? (from a development perspective, it doesn't really matter so much, adding this feature to all backends will be roughly the same amount of work). Note that measurements, being random, are not differentiable, which means you can't train circuits containing measurements. So there may not be any advantage to using the TF backend for this. If you are not concerned with differentiability, as a quick workaround, you could use the existing
|
If you want to optimize a conditional state you can use a constant projector onto the outcome of the measurement that you want.
|
At the moment this can be hacked by doing
MeasureFock
and converting any nonzero results to a value of 1. However, there is likely a simpler way to implement these things by leveraging sampling algorithms in thehafnian
library (at least for Gaussian and Fock backends).@nquesada @josh146 thoughts?
The text was updated successfully, but these errors were encountered: