From fa4f142aa7d72e8012539af35d6d357333e68d79 Mon Sep 17 00:00:00 2001 From: Junye Huang Date: Fri, 4 Mar 2022 10:32:24 +0100 Subject: [PATCH] Handle BackendV2 in transpiler._parse_inst_map --- qiskit/compiler/transpiler.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/qiskit/compiler/transpiler.py b/qiskit/compiler/transpiler.py index da80259c89fc..60101423ec4f 100644 --- a/qiskit/compiler/transpiler.py +++ b/qiskit/compiler/transpiler.py @@ -673,9 +673,7 @@ def _parse_inst_map(inst_map, backend, num_circuits): if hasattr(backend, "defaults"): inst_map = getattr(backend.defaults(), "instruction_schedule_map", None) else: - # BackendV2 always have `defaults` attribute - if backend.defaults(): - inst_map = getattr(backend.defaults(), "instruction_schedule_map", None) + inst_map = backend.target.instruction_schedule_map() # inst_maps could be None, or single entry if inst_map is None or isinstance(inst_map, InstructionScheduleMap):