Is there any way I can retrieve a pre-measurment state vector as ket using Pennylane? It seems Strawberry Fields does allow an operation without measurement. For example:
state = eng.run(“tf”, cutoff_dim=cutoff, eval=False, batch_size=batch_size)
ket = state.ket()
But Pennylane wouldn’t allow me to run without specifying a measurement method. Any advice?
Oh, I forgot to ask beforehand — are you performing a CV/photonics simulation in PL? Unfortunately in that case, returning qml.state() is not yet supported with the Strawberry Fields devices.
If you have the time, opening an issue on the PennyLane-SF GitHub repo with the requested feature would be greatly appreciated, and allow our development team to see the feature request! Otherwise, I will pass it on to the team
Thank you, Josh. Yes, I am using a simulator and ran into problems with qml.state() although it is listed as one of the measurement options in PL documentation.
Thank you for your reply. If you guide me as to where to start, I would love to work on it.
I am working on classical and qnn hybrid network for credit card fraud detection (StrawberryFields + Keras) and have a crude code for classical and quantum hybrid auto-encoder model (Pennylane + Keras).
Hi @sophchoe. I’m glad you would like to work on this!
The first step would be to write on the GitHub issue that you would like to work on this, just in case to prevent double work from someone else.
The next step would be to go through the code where the issue happens and trying to understand how it works.
Once you have this you can try attempting a workaround or a solution. Taking small steps and testing the result is a good way to go forward.
I suggest that you also share any solution ideas that you might have with us on GitHub, so that you can have someone else take a look to see if it could be a good approach.
I hope this helps!
Also, the two projects you mention look great. Hopefully you can create a demo when you’re finished!
I have a working code (Jupyter Notebook) on the auto-encoder I mentioned about, using Keras and Pennylane. Since we can’t directly access the ket vectors from Pennylane yet, I made some modifications to the algorithm defined in the “Continuous Variable quantum neural networks” paper. I used the probability measurement method of cutoff dimension 3 to create output vectors of length 3 and using MSE to optimize the hybrid network.
Ok! No next steps from your side. We’ll make the update and hopefully it should be showing up on the page this week. I’ll let you know here when it’s up!
Yes @CatalinaAlbornoz , I saw about QHack today and will check it out.
I am running experiments of CV MNIST classifiers varying the number of qumodes and cutoff dimension. They work nicely, but my local Jupyter Notebook connection cut off randomly and I lost over 90 epoch results for 5, 6, 7, 8 qumodes. I will post on the same repository and let you know when I get experimental results.
I am modifying the Quavolutional neural network on your main demo page into a continuous variable version. I may have to do parameter updates manually, since the stride operation is not readily translatable to Keras. (Unless you have Keras Convolution plug-in features ). I will write a paper and submit the code and paper when I’m done.