You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes we get this to_matrix not defined for this error. To reproduce this we can use the following code:
from qiskit_transpiler_service.ai.synthesis import AILinearFunctionSynthesis
from qiskit_transpiler_service.ai.collection import CollectLinearFunctions
from qiskit_transpiler_service.ai.routing import AIRouting
from qiskit.transpiler import PassManager
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit.circuit.library import EfficientSU2
import numpy as np
circuit = QuantumCircuit(4)
for i in range(4):
circuit.h(i)
for i in range(3):
circuit.rxx(np.pi/4, i, i+1)
circuit.rzz(np.pi/3, i, i+1)
circuit.cx(i, i+1)
runtime_service = QiskitRuntimeService()
backend_name = "ibm_sherbrooke"
backend = runtime_service.get_backend(backend_name)
# Base Qiskit lvl3 transpiler
lvl3_plus_ai = generate_preset_pass_manager(optimization_level=3, backend=backend) # Here you include your backend object (ibm_sherbrooke)
# We replace the base routing with the AI-routing
lvl3_plus_ai.layout = None
lvl3_plus_ai.routing = PassManager([
AIRouting(backend_name=backend_name, optimization_level=3, layout_mode="optimize") # AI Routing
])
# We include synthesis as a post-routing process
lvl3_plus_ai.post_routing = PassManager([
CollectLinearFunctions(), # Collect linear functions
AILinearFunctionSynthesis(backend_name=backend_name) # Optimize linear functions
])
ai_transpiled_circ = lvl3_plus_ai.run(circuit)
The text was updated successfully, but these errors were encountered:
Sometimes we get this
to_matrix not defined for this
error. To reproduce this we can use the following code:The text was updated successfully, but these errors were encountered: