catalyst icon indicating copy to clipboard operation
catalyst copied to clipboard

Fix ZNE with measurements_from_samples

Open rmoyard opened this issue 1 year ago • 2 comments
trafficstars

Context:

  1. Jax generates additional const arguments with [...], and take.

  2. The mitigate_with_zne does not work when using the measurements_from_sample function. The root of the the issue is the function removeQuantumMeasurements that tries to remove all users of the measurments. But potentially users are located in a block of an operations, therefore emptying the block but not the operation.

Description of the Change:

  1. The JaxPr const are added to the ZNE op args.
  2. removeQuantumMeasurements is replaced by replaceQuantumMeasurements, this functions is replacing quantum measurements with empty tensors. The tensors are remove in the bufferization pass. (--inline, --canonicalize)

Benefits: ZNE with shots works with hardware devices (counts and samples)

rmoyard avatar Sep 30 '24 20:09 rmoyard