qiskit.transpiler.InstructionDurations¶

class
InstructionDurations
(instruction_durations=None, dt=None)[소스]¶ Helper class to provide durations of instructions for scheduling.
It stores durations (gate lengths) and dt to be used at the scheduling stage of transpiling. It can be constructed from
backend
orinstruction_durations
, which is an argument oftranspile()
.
__init__
(instruction_durations=None, dt=None)[소스]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
([instruction_durations, dt])Initialize self.
from_backend
(backend)Construct an
InstructionDurations
object from the backend.get
(inst, qubits[, unit])Get the duration of the instruction with the name and the qubits.
Get the set of all units used in this instruction durations.
update
(inst_durations[, dt])Update self with inst_durations (inst_durations overwrite self).

classmethod
from_backend
(backend)[소스]¶ Construct an
InstructionDurations
object from the backend. 매개변수
backend (
BaseBackend
) – backend from which durations (gate lengths) and dt are extracted. 반환값
The InstructionDurations constructed from backend.
 반환 형식
 예외
TranspilerError – If dt and dtm is different in the backend.

get
(inst, qubits, unit='dt')[소스]¶ Get the duration of the instruction with the name and the qubits.
 매개변수
inst (
Union
[str
,Instruction
]) – An instruction or its name to be queried.qubits (
Union
[int
,List
[int
],Qubit
,List
[Qubit
]]) – Qubits or its indices that the instruction acts on.unit (
str
) – The unit of duration to be returned. It must be ‘s’ or ‘dt’.
 반환값
The duration of the instruction on the qubits.
 반환 형식
floatint
 예외
TranspilerError – No duration is defined for the instruction.

units_used
()[소스]¶ Get the set of all units used in this instruction durations.
 반환 형식
Set
[str
] 반환값
Set of units used in this instruction durations.

update
(inst_durations, dt=None)[소스]¶ Update self with inst_durations (inst_durations overwrite self).
 매개변수
inst_durations (
Optional
[Union
[List
[Tuple
[str
,Optional
[Iterable
[int
]],Union
[float
,int
],str
]],List
[Tuple
[str
,Optional
[Iterable
[int
]],Union
[float
,int
]]],InstructionDurations
]]) – Instruction durations to be merged into self (overwriting self).dt (
Optional
[float
]) – Sampling duration in seconds of the target backend.
 반환값
The updated InstructionDurations.
 반환 형식
 예외
TranspilerError – If the format of instruction_durations is invalid.
