2
$\begingroup$

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.

$\endgroup$

1 Answer 1

1
$\begingroup$

Using tfq.layers.State() you can directly access the state amplitudes and you do not need operators.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.