Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version


class TranslateParameterizedGates(*args, **kwargs)

GitHub(opens in a new tab)

Bases: qiskit.transpiler.basepasses.TransformationPass

Translate parameterized gates to a supported basis set.

Once a parameterized instruction is found that is not in the supported_gates list, the instruction is decomposed one level and the parameterized sub-blocks are recursively decomposed. The recursion is stopped once all parameterized gates are in supported_gates, or if a gate has no definition and a translation to the basis is attempted (this might happen e.g. for the UGate if it’s not in the specified gate list).


The following, multiply nested circuit:

from qiskit.circuit import QuantumCircuit, ParameterVector
from qiskit.transpiler.passes import TranslateParameterizedGates
x = ParameterVector("x", 4)
block1 = QuantumCircuit(1)
block1.rx(x[0], 0)
sub_block = QuantumCircuit(2), 1)
sub_block.rz(x[2], 0)
block2 = QuantumCircuit(2)
block2.ry(x[1], 0)
block2.append(sub_block.to_gate(), [0, 1])
block3 = QuantumCircuit(3)
block3.ccx(0, 1, 2)
circuit = QuantumCircuit(3)
circuit.append(block1.to_gate(), [1])
circuit.append(block2.to_gate(), [0, 1])
circuit.append(block3.to_gate(), [0, 1, 2])
circuit.cry(x[3], 0, 2)
supported_gates = ["rx", "ry", "rz", "cp", "crx", "cry", "crz"]
unrolled = TranslateParameterizedGates(supported_gates)(circuit)

is decomposed to:

     ┌──────────┐     ┌──────────┐┌─────────────┐
q_0:Ry(x[1]) ├──■──┤ Rz(x[2]) ├┤0            ├─────■──────
     ├──────────┤┌─┴─┐└──────────┘│             │     │
q_1:Rx(x[0]) ├┤ X ├────────────┤1 circuit-92 ├─────┼──────
     └──────────┘└───┘            │             │┌────┴─────┐
q_2: ─────────────────────────────┤2            ├┤ Ry(x[3])


  • supported_gates – A list of suppported basis gates specified as string. If None, a target must be provided.
  • equivalence_library – The equivalence library to translate the gates. Defaults to the equivalence library of all Qiskit standard gates.
  • target – A Target containing the supported operations. If None, supported_gates must be set. Note that this argument takes precedence over supported_gates, if both are set.


ValueError – If neither of supported_gates and target are passed.



Return the name of the pass.


Run the transpiler pass.


dag (DAGCircuit) – The DAG circuit in which the parameterized gates should be unrolled.

Return type



A DAG where the parameterized gates have been unrolled.


QiskitError – If the circuit cannot be unrolled.



Check if the pass is an analysis pass.

If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass.


Check if the pass is a transformation pass.

If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read).

Was this page helpful?
Report a bug or request content on GitHub.