Skip to content

Commit

Permalink
Improve "Custom Pass Managers" docs (Qiskit#11288)
Browse files Browse the repository at this point in the history
* fix import in transpiler docs code example

* other improvements

* fix stage <-> pass manager mix up
  • Loading branch information
kevinsung authored Nov 21, 2023
1 parent 7258a34 commit 2935f0d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions qiskit/transpiler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,17 @@
In addition to modifying preset pass managers, it is also possible to construct a pass
manager to build an entirely custom pipeline for transforming input
circuits. You can leverage the :class:`~.StagedPassManager` class directly to do
circuits. You can use the :class:`~.StagedPassManager` class directly to do
this. You can define arbitrary stage names and populate them with a :class:`~.PassManager`
instance. For example::
instance. For example, the following code creates a new :class:`~.StagedPassManager`
that has 2 stages, ``init`` and ``translation``.::
from qiskit.transpiler.passes import (
UnitarySynthesis,
Collect2qBlocks,
ConsolidateBlocks,
UnitarySynthesis,
Unroll3qOrMore,
)
from qiskit.transpiler import PassManager, StagedPassManager
Expand All @@ -171,13 +173,11 @@
stages=["init", "translation"], init=init, translation=translate
)
will create a new :class:`~.StagedPassManager` that has 2 stages ``init`` and ``translation``.
There is no limit on the number of stages you can put in a custom :class:`~.StagedPassManager`
instance.
There is no limit on the number of stages you can put in a :class:`~.StagedPassManager`.
The :ref:`stage_generators` functions may be useful for the construction of custom pass managers.
They generate stages which provide common functionality used in many pass managers.
For example, :func:`~.generate_embed_passmanager` can be used to generate a stage
The :ref:`stage_generators` may be useful for the construction of custom :class:`~.StagedPassManager`s.
They generate pass managers which provide common functionality used in many stages.
For example, :func:`~.generate_embed_passmanager` generates a :class:`~.PassManager`
to "embed" a selected initial :class:`~.Layout` from a layout pass to the specified target device.
Representing Quantum Computers
Expand Down

0 comments on commit 2935f0d

Please sign in to comment.