0
$\begingroup$

In the documentation of tfq.layers.ControlledPQC, the authors provide model_params as one of the argument to the ControlledPQC object outputs. I am unable to interpret how this gets used the the model. If those are the values for alpha and beta then we should have given only 2 values but we have a $2\times 2$ matrix here. I have pasted the code below for reference:

bit = cirq.GridQubit(0, 0)
model = cirq.Circuit(
    cirq.X(bit) ** sympy.Symbol('alpha'),
    cirq.Z(bit) ** sympy.Symbol('beta')
)
outputs = tfq.layers.ControlledPQC(model, cirq.Z(bit))
quantum_data = tfq.convert_to_tensor([
    cirq.Circuit(),
    cirq.Circuit(cirq.X(bit))
])
model_params = tf.convert_to_tensor([[0.5, 0.5], [0.25, 0.75]])
res = outputs([quantum_data, model_params])
res
$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.