CircuitPreprocessor¶
- class CircuitPreprocessor(name, preprocess=<function _identity>, result_format=ResultFormat.EXPVALS, terminal_stage=None, consumes_dag_bodies=False, cache_key=None)[source]¶
Bases:
objectA named seed transform and the readout it targets.
- Variables:
name – Identifier for the routine (
"cost","sample", …).preprocess – Transform applied to each post-spec
MetaCircuitbefore mitigation and the terminal measurement. Defaults to identity.result_format – Format the raw backend results convert into; also drives error-mitigation applicability when the pipeline is assembled. Defaults to expectation values.
terminal_stage – Optional custom
handles_measurementterminal.Nonemeans the program supplies its defaultMeasurementStage(configured with the program’s grouping / shot strategy); PCE supplies its ownPCECostStage.consumes_dag_bodies – Whether
preprocessreads or replaces circuit DAG bodies. Metadata-only transforms leave thisFalseso dry runs can keep analytic shortcuts.cache_key – Identity under which
_build_preprocessor_pipeline()memoizes the assembled pipeline (so its forward-pass cache survives across optimizer iterations).None(the default) means do not cache — the pipeline is rebuilt per call and discarded. Every built-in routine (cost/sample/evolution/overlap and the metric estimators) passes a constant key, because each one’spreprocessis a pure transform; per-iteration freshness where it is needed (the QDrift stochastic resampling) comes from the spec stage’scache_key_extrasinvalidating the forward-pass cache, not from leaving thisNone.
Attributes Summary
Methods Summary
Attributes Documentation
- result_format: ResultFormat = 'expvals'¶
Methods Documentation
- preprocess()¶
- Return type: