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.
$\begingroup$
$\endgroup$
Add a comment
|
1 Answer
$\begingroup$
$\endgroup$
Using tfq.layers.State()
you can directly access the state amplitudes and you do not need operators.