I am trying to train a quantum neural network in tensorflow_quantum (tfq). Using cirq.Circuit I have set up my circuit. I now need to wrap it in a keras model for training. For this I must embed the circuit in a tfq.layers.PQC layer (according to the documentation: "this layer is for training parameterized quantum models"). However, when using PQC, I must specify a value for the parameter operators, which must be a cirq.PauliSum or Python list of cirq.PauliSum objects. I am unsure how to obtain the amplitudes via these kind of operators, but since I am dealing with a simulator I think it should not be necessary. Is there a way to train my circuit using the amplitudes of the circuit output? Thanks in advance.
Asked
Active
Viewed 125 times
2
glS
- 27,510
- 7
- 37
- 125
1 Answers
1
Using tfq.layers.State() you can directly access the state amplitudes and you do not need operators.
owen
- 11
- 2