I’ve been wanting to implement shot noise into my code, using tfq.layers.NoisyPQC.
The documentation says as follows:
tfq.layers.NoisyPQC(
circuit,
cirq.Z(q),
repetitions=1000,
sample_based=False
)
In the above example we estimate the value of the expectation using monte-carlo trajectory simulations and analytic expectation calculation. To emulate the process used when sampling from a truly noisy device, we set
sampled_based=True
to estimate the expectation value via noisy bitstring sampling.
Now, I interpreted the NoisyPQC as if the repetitions were shots, because that is what the repetitions are for the regular PQC, according to its documentation. But, when I look at the documentation on the NoisyPQC, it looks as if ‘sample_based’ needs to be True to do shots. In that case, I do not know what the repetitions do when sample_based =False? The NoisyPQC does not function with repetitions = None.
My question is, would I be able to simulate shot noise when I set sampled_based=True
, and is the number of repetitions than the shot
number? I find it hard to say for certain based on the documentation.