qiskit.visualization.pass_manager_drawer#

qiskit.visualization.pass_manager_drawer(pass_manager, filename=None, style=None, raw=False)[source]#

Draws the pass manager.

This function needs pydot, which in turn needs Graphviz to be installed.

প্যারামিটার:
  • pass_manager (PassManager) -- the pass manager to be drawn

  • filename (str) -- file path to save image to

  • style (dict or OrderedDict) -- 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) -- True if you want to save the raw Dot output not an image. The default is False.

রিটার্নস:

an in-memory representation of the pass manager. Or None if no image was generated or PIL is not installed.

রিটার্ন টাইপ:

PIL.Image or None

রেইজেস:

Example

 %matplotlib inline
from qiskit import QuantumCircuit
from qiskit.compiler import transpile
from qiskit.transpiler import PassManager
from qiskit.visualization import pass_manager_drawer
from qiskit.transpiler.passes import Unroller

circ = QuantumCircuit(3)
circ.ccx(0, 1, 2)
circ.draw()

pass_ = Unroller(['u1', 'u2', 'u3', 'cx'])
pm = PassManager(pass_)
new_circ = pm.run(circ)
new_circ.draw(output='mpl')

pass_manager_drawer(pm, "passmanager.jpg")