From 75e5ea465d7c93e3543d2116e7beaa2d103284ae Mon Sep 17 00:00:00 2001 From: Yaiza Date: Wed, 6 Nov 2024 09:47:28 +0100 Subject: [PATCH] Instanciate AIRouting backend attribute for all the cases --- qiskit_ibm_transpiler/ai/routing.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qiskit_ibm_transpiler/ai/routing.py b/qiskit_ibm_transpiler/ai/routing.py index 37aaf48..2ff5f3e 100644 --- a/qiskit_ibm_transpiler/ai/routing.py +++ b/qiskit_ibm_transpiler/ai/routing.py @@ -68,9 +68,11 @@ def __init__( if backend_name is not None: self.backend = backend_name elif coupling_map is not None: - if isinstance(coupling_map, list): + if isinstance(coupling_map, CouplingMap): + self.backend = coupling_map + elif isinstance(coupling_map, list): self.backend = CouplingMap(coupling_map) - elif not isinstance(coupling_map, CouplingMap): + else: raise ValueError( f"ERROR. coupling_map should either be a list of int tuples or a Qiskit CouplingMap object." )