IBM-Q states that the real devices available for public use have a set of "basis" gates consisting of u1,u2,u3 and CNOT. However in Qiskit the circuit can be built with many gates which are not directly one of these. For example the controlled u1 gate is an "elementary operation" in QISKit, but it is not a basis gate in for the device.

In order to have such a circuit be executed on a real device these gates must be decomposed into the device's basis gates. I assume this is handled by the compile function.

Is there an easy way in QISKit to see the quantum circuit after this step has taken place?


1 Answer 1


The function that handles this is transpile(), which could be found in qiskit.compiler. When you call transpile(circuit, backend) it goes through the compilation process for the input circuit based on the backend you provide. It returns a new circuit that will be valid to run on the provided backend.

You can then view this new circuit just like you would with any circuit, either print(circuit) or circuit.draw().


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.