qiskit-documentation/docs/api/qiskit-transpiler-service/qiskit_transpiler_service.t...

42 lines
3.1 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
description: API reference for qiskit_transpiler_service.transpiler_service.TranspilerService
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit_transpiler_service.transpiler_service.TranspilerService
---
# TranspilerService
<Class id="qiskit_transpiler_service.transpiler_service.TranspilerService" isDedicatedPage={true} signature="qiskit_transpiler_service.transpiler_service.TranspilerService(optimization_level, ai=True, coupling_map=None, backend_name=None, qiskit_transpile_options=None, ai_layout_mode=None)" 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.
* **ai** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)")*, optional*) Specifyies 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_transpiler_service.transpiler_service.TranspilerService.run" 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.1)")*] |* [*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)") *|*[*QuantumCircuit*](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.1)")) circuit(s) to transpile.
**Returns**
The transpiled circuit(s)
</Function>
</Class>