AddTags
class samplomatic.transpiler.passes.AddTags(*args, **kwargs)
Bases: TransformationPass
Inserts Tag annotations to all box instructions.
This pass finds all box nodes in the DAG and adds Tag annotations to them. The tagging mode controls how ref strings 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
Column 1 | Column 2 |
|---|---|
run(dag) | Run a pass on the DAGCircuit. |
Methods Documentation
run
run(dag: DAGCircuit) → DAGCircuit
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.
Was this page helpful?
Report a bug, typo, or request content on GitHub.