Mixing PyQuil and PennyLane code


#1

I’m trying to build a quantum GAN in PennyLane similar to the example in the Python notebook presented in class. However, I’d like to teach the generator of the GAN to learn a series of quantum operations that have been defined in a PyQuil program. Basically the generator is to learn this function that was defined in a PyQuil program. Let’s say that the output of this program is N qbits. How do I get PennyLane to read in this output in the as wires 0-8 in PennyLane? I’m assuming this has to do with devices like so? https://pennylane-forest.readthedocs.io/en/latest/usage.html


#2

Hi @pgarz! You might need to provide me with more details so that I can understand your problem.

Do you have an existing pyQuil program, and you would like to be able to use this directly in a PennyLane QNode?


#3

Yes, I basically have a separate script that creates an output of 9 qbits and it’s written in PyQuil. I would like to execute this script and then have my PennyLane script be able to read in this output into the first 9 wires. I don’t need PennyLane specific stuff to happen as part of this PyQuil operation. My PennyLane program just needs to start reading in these 9 qbits at that state and move on from there. I guess I could try to rewrite this all strictly in PennyLane, but I’m wondering if there’s an easy option here.


#4

Unfortunately, the only supported way at the moment is to rewrite it all strictly in PennyLane.

However, we are working towards adding Quil support in PennyLane soon :slightly_smiling_face:


#5

Gotcha, that makes sense. Thanks for the help!