qiskit-documentation/docs/api/qiskit-ibm-transpiler/0.6/qiskit_ibm_transpiler.trans...

43 lines
3.9 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: TranspilerService (v0.6)
description: API reference for qiskit_ibm_transpiler.transpiler_service.TranspilerService in qiskit-ibm-transpiler v0.6
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit_ibm_transpiler.transpiler_service.TranspilerService
---
# TranspilerService
<Class id="qiskit_ibm_transpiler.transpiler_service.TranspilerService" isDedicatedPage={true} github="https://github.com/Qiskit/qiskit-ibm-transpiler/tree/stable/0.6/qiskit_ibm_transpiler/transpiler_service.py#L42-L124" signature="qiskit_ibm_transpiler.transpiler_service.TranspilerService(optimization_level, ai='true', coupling_map=None, backend_name=None, qiskit_transpile_options=None, ai_layout_mode=None, optimization_preferences=None, **kwargs)" modifiers="class">
Bases: [`object`](https://docs.python.org/3/library/functions.html#object "(in Python v3.12)")
Class for using the transpiler service.
**Parameters**
* **optimization\_level** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")) The optimization level to use during the transpilation. There are 4 optimization levels ranging from 0 to 3, where 0 is intended for not performing any optimizations and 3 spends the most effort to optimize the circuit.
* **optimization\_preferences** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)") *|*[*list*](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.12)")*\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")*], optional*) Describe your preferences with a value or a list of values when prioritizing optimization. Allowed options: noise, n\_cnots, n\_gates, cnot\_layers, layers.
* **ai** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")*, optional*) Specifies if the transpilation should use AI or not, defaults to True.
* **coupling\_map** ([*list*](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.12)")*\[*[*list*](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.12)")*\[*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")*]], optional*) A list of pairs that represents physical links between qubits.
* **backend\_name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")*, optional*) Name of the backend used for doing the transpilation.
* **qiskit\_transpile\_options** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.12)")*, optional*) Other options to transpile with qiskit.
* **ai\_layout\_mode** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")*, optional*) Specifies how to handle the layout selection. There are 3 layout modes: keep (respects the layout set by the previous transpiler passes), improve (uses the layout set by the previous transpiler passes as a starting point) and optimize (ignores previous layout selections).
## Methods
### run
<Function id="qiskit_ibm_transpiler.transpiler_service.TranspilerService.run" github="https://github.com/Qiskit/qiskit-ibm-transpiler/tree/stable/0.6/qiskit_ibm_transpiler/transpiler_service.py#L95-L124" signature="run(circuits)">
Transpile the circuit(s) by calling the service /transpile endpoint.
**Parameters**
**circuits** ([*List*](https://docs.python.org/3/library/typing.html#typing.List "(in Python v3.12)")*\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)") *|*[*QuantumCircuit*](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.2)")*] |* [*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)") *|*[*QuantumCircuit*](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.2)")) circuit(s) to transpile.
**Returns**
The transpiled circuit(s)
</Function>
</Class>