Open
Description
Example
c = cirq.Circuit()
qubits = cirq.GridQubit.rect(2, 1)
c.append(cirq.rz(0.)(qubits[0]))
c.append(cirq.H(qubits[1]))
sampled_expectation_layer = tfq.layers.SampledExpectation()
output = sampled_expectation_layer(
[c],
operators=[cirq.Z(qubits[0]), cirq.Z(qubits[1]), cirq.Z(qubits[0]) * cirq.Z(qubits[1])],
repetitions=1)
print(output) # we have [1, -1, 1] sometimes
assert output[0,0]*output[0,1] == output[0,2] # and this may fail
It is unnatural to me that, when repetitions=1
(1 sample), we have inconsistent measurement results between Z1, Z2 and Z1*Z2.
And from code here
quantum/tensorflow_quantum/core/ops/batch_util.py
Lines 554 to 561 in db2eac4
My understanding may be wrong somewhere, any ideas on this?