Skip to main contentIBM Quantum Documentation


qiskit.transpiler.PassManager(passes=(), max_iteration=1000)GitHub(opens in a new tab)

Bases: BasePassManager

Manager for a set of Passes and their scheduling during transpilation.

Initialize an empty pass manager object.


  • passes (Task | list(opens in a new tab)[Task]) – A pass set to be added to the pass manager schedule.
  • max_iteration (int(opens in a new tab)) – The maximum number of iterations the schedule will be looped if the condition is not met.




Append a Pass Set to the schedule of passes.


passes (Task | list(opens in a new tab)[Task]) – A set of transpiler passes to be added to schedule.


TranspilerError – if a pass in passes is not a proper pass.


draw(filename=None, style=None, raw=False)

Draw the pass manager.

This function needs pydot(opens in a new tab), which in turn needs Graphviz(opens in a new tab) to be installed.


  • filename (str(opens in a new tab)) – file path to save image to.
  • style (dict(opens in a new tab)) – keys are the pass classes and the values are the colors to make them. An example can be seen in the DEFAULT_STYLE. An ordered dict can be used to ensure a priority coloring when pass falls into multiple categories. Any values not included in the provided dict will be filled in from the default dict.
  • raw (bool(opens in a new tab)) – If True, save the raw Dot output instead of the image.


an in-memory representation of the pass manager, or None if no image was generated or Pillow(opens in a new tab) is not installed.

Return type



ImportError(opens in a new tab) – when nxpd or pydot not installed.



Removes a particular pass in the scheduler.


index (int(opens in a new tab)) – Pass index to remove, based on the position in passes().


PassManagerError – If the index is not found.


replace(index, passes)

Replace a particular pass in the scheduler.



run(circuits, output_name=None, callback=None, num_processes=None)

Run all the passes on the specified circuits.


  • circuits (_CircuitsT) – Circuit(s) to transform via all the registered passes.

  • output_name (str(opens in a new tab) | None) – The output circuit name. If None, it will be set to the same as the input circuit name.

  • callback (Callable) –

    A callback function that will be called after each pass execution. The function will be called with 5 keyword arguments:

    pass_ (Pass): the pass being run
    dag (DAGCircuit): the dag output of the pass
    time (float): the time to execute the pass
    property_set (PropertySet): the property set
    count (int): the index for the pass execution

    Beware that the keyword arguments here are different to those used by the generic BasePassManager. This pass manager will translate those arguments into the form described above.

    The exact arguments pass expose the internals of the pass manager and are subject to change as the pass manager internals change. If you intend to reuse a callback function over multiple releases be sure to check that the arguments being passed are the same.

    To use the callback feature you define a function that will take in kwargs dict and access the variables. For example:

    def callback_func(**kwargs):
        pass_ = kwargs['pass_']
        dag = kwargs['dag']
        time = kwargs['time']
        property_set = kwargs['property_set']
        count = kwargs['count']
  • num_processes (int(opens in a new tab)) – The maximum number of parallel processes to launch if parallel execution is enabled. This argument overrides num_processes in the user configuration file, and the QISKIT_NUM_PROCS environment variable. If set to None the system default or local user configuration will be used.


The transformed circuit(s).

Return type




Linearize this manager into a single FlowControllerLinear, so that it can be nested inside another pass manager.


A linearized pass manager.

Return type


Was this page helpful?