AddTags¶
- class samplomatic.transpiler.passes.AddTags(*args, **kwargs)[source]¶
Bases:
TransformationPassInserts
Tagannotations to all box instructions.This pass finds all
boxnodes in the DAG and addsTagannotations to them. The tagging mode controls howrefstrings are assigned:'unique_box': therefis a truncated hash of the box’s structural content (i.e. ignoring single-qubit gate, and seeBoxKey), so structurally equivalent boxes share the samerefacross circuits. Boxes with differentTwirlspecifications are treated as unique, but all other annotations are ignored when comparing boxes.'unique_instance': therefis an incrementing counter (t0,t1, …), so every box in a circuit gets a uniqueref. The counter resets on each call torun().'noise_ref': therefis taken from the box’sInjectNoiseannotation’sreffield joined by an underscore with itsmodifier_reffield when present. Boxes without anInjectNoiseannotation are skipped.
- Parameters:
mode – The tagging mode.
'unique_box'assigns the same ref to structurally equivalent boxes;'unique_instance'assigns a unique ref to every box.overwrite – Whether to overwrite
Tagannotations that are already present in the circuit.prefix_ref – A prefix to all the
refstrings generated by this class.
Methods Summary
run(dag)Run a pass on the DAGCircuit.
Methods Documentation
- run(dag: DAGCircuit) → DAGCircuit[source]¶
Run a pass on the DAGCircuit. This is implemented by the pass developer.
- Parameters:
dag – the dag on which the pass is run.
- Raises:
NotImplementedError – when this is left unimplemented for a pass.