Skip to content

Commit

Permalink
Passes CouplingMap object to routing providers
Browse files Browse the repository at this point in the history
  • Loading branch information
y4izus committed Nov 5, 2024
1 parent 0c9d605 commit b31b5fc
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions local-mode-routing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -20,7 +20,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -39,7 +39,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand All @@ -56,7 +56,7 @@
"<Figure size 1766.85x1678.91 with 1 Axes>"
]
},
"execution_count": 3,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -78,17 +78,17 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"outputs": [
{
"ename": "AttributeError",
"evalue": "'list' object has no attribute 'distance_matrix'",
"evalue": "'AIRouting' object has no attribute 'backend'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[4], line 9\u001b[0m\n\u001b[1;32m 1\u001b[0m ai_transpiler \u001b[38;5;241m=\u001b[39m PassManager(\n\u001b[1;32m 2\u001b[0m [\n\u001b[1;32m 3\u001b[0m AIRouting(\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 6\u001b[0m ]\n\u001b[1;32m 7\u001b[0m )\n\u001b[0;32m----> 9\u001b[0m ai_transpiled_circuit \u001b[38;5;241m=\u001b[39m \u001b[43mai_transpiler\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcircuit\u001b[49m\u001b[43m)\u001b[49m\n",
"Cell \u001b[0;32mIn[5], line 9\u001b[0m\n\u001b[1;32m 1\u001b[0m ai_transpiler \u001b[38;5;241m=\u001b[39m PassManager(\n\u001b[1;32m 2\u001b[0m [\n\u001b[1;32m 3\u001b[0m AIRouting(\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 6\u001b[0m ]\n\u001b[1;32m 7\u001b[0m )\n\u001b[0;32m----> 9\u001b[0m ai_transpiled_circuit \u001b[38;5;241m=\u001b[39m \u001b[43mai_transpiler\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcircuit\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/Documents/development/ai-and-data-public/qiskit-ibm-transpiler/.venv-qiskit-ibm-transpiler/lib/python3.11/site-packages/qiskit/transpiler/passmanager.py:464\u001b[0m, in \u001b[0;36m_replace_error.<locals>.wrapper\u001b[0;34m(*meth_args, **meth_kwargs)\u001b[0m\n\u001b[1;32m 461\u001b[0m \u001b[38;5;129m@wraps\u001b[39m(meth)\n\u001b[1;32m 462\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mwrapper\u001b[39m(\u001b[38;5;241m*\u001b[39mmeth_args, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mmeth_kwargs):\n\u001b[1;32m 463\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 464\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mmeth\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mmeth_args\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mmeth_kwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 465\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m PassManagerError \u001b[38;5;28;01mas\u001b[39;00m ex:\n\u001b[1;32m 466\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m TranspilerError(ex\u001b[38;5;241m.\u001b[39mmessage) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mex\u001b[39;00m\n",
"File \u001b[0;32m~/Documents/development/ai-and-data-public/qiskit-ibm-transpiler/.venv-qiskit-ibm-transpiler/lib/python3.11/site-packages/qiskit/transpiler/passmanager.py:226\u001b[0m, in \u001b[0;36mPassManager.run\u001b[0;34m(self, circuits, output_name, callback, num_processes)\u001b[0m\n\u001b[1;32m 223\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m callback \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 224\u001b[0m callback \u001b[38;5;241m=\u001b[39m _legacy_style_callback(callback)\n\u001b[0;32m--> 226\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 227\u001b[0m \u001b[43m \u001b[49m\u001b[43min_programs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcircuits\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 228\u001b[0m \u001b[43m \u001b[49m\u001b[43mcallback\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcallback\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 229\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_name\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_name\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 230\u001b[0m \u001b[43m \u001b[49m\u001b[43mnum_processes\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnum_processes\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 231\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/Documents/development/ai-and-data-public/qiskit-ibm-transpiler/.venv-qiskit-ibm-transpiler/lib/python3.11/site-packages/qiskit/passmanager/passmanager.py:231\u001b[0m, in \u001b[0;36mBasePassManager.run\u001b[0;34m(self, in_programs, callback, num_processes, **kwargs)\u001b[0m\n\u001b[1;32m 228\u001b[0m \u001b[38;5;66;03m# If we're not going to run in parallel, we want to avoid spending time `dill` serializing\u001b[39;00m\n\u001b[1;32m 229\u001b[0m \u001b[38;5;66;03m# ourselves, since that can be quite expensive.\u001b[39;00m\n\u001b[1;32m 230\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(in_programs) \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m1\u001b[39m \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m should_run_in_parallel(num_processes):\n\u001b[0;32m--> 231\u001b[0m out \u001b[38;5;241m=\u001b[39m \u001b[43m[\u001b[49m\n\u001b[1;32m 232\u001b[0m \u001b[43m \u001b[49m\u001b[43m_run_workflow\u001b[49m\u001b[43m(\u001b[49m\u001b[43mprogram\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mprogram\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpass_manager\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcallback\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcallback\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 233\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43;01mfor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mprogram\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43min_programs\u001b[49m\n\u001b[1;32m 234\u001b[0m \u001b[43m \u001b[49m\u001b[43m]\u001b[49m\n\u001b[1;32m 235\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(in_programs) \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m1\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m is_list:\n\u001b[1;32m 236\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m out[\u001b[38;5;241m0\u001b[39m]\n",
Expand All @@ -97,9 +97,8 @@
"File \u001b[0;32m~/Documents/development/ai-and-data-public/qiskit-ibm-transpiler/.venv-qiskit-ibm-transpiler/lib/python3.11/site-packages/qiskit/passmanager/base_tasks.py:218\u001b[0m, in \u001b[0;36mBaseController.execute\u001b[0;34m(self, passmanager_ir, state, callback)\u001b[0m\n\u001b[1;32m 216\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m passmanager_ir, state\n\u001b[1;32m 217\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[0;32m--> 218\u001b[0m passmanager_ir, state \u001b[38;5;241m=\u001b[39m \u001b[43mnext_task\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexecute\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 219\u001b[0m \u001b[43m \u001b[49m\u001b[43mpassmanager_ir\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpassmanager_ir\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 220\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstate\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 221\u001b[0m \u001b[43m \u001b[49m\u001b[43mcallback\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcallback\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 222\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 223\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 224\u001b[0m \u001b[38;5;66;03m# Sending the object through the generator implies the custom controllers\u001b[39;00m\n\u001b[1;32m 225\u001b[0m \u001b[38;5;66;03m# can always rely on the latest data to choose the next task to run.\u001b[39;00m\n\u001b[1;32m 226\u001b[0m next_task \u001b[38;5;241m=\u001b[39m task_generator\u001b[38;5;241m.\u001b[39msend(state)\n",
"File \u001b[0;32m~/Documents/development/ai-and-data-public/qiskit-ibm-transpiler/.venv-qiskit-ibm-transpiler/lib/python3.11/site-packages/qiskit/transpiler/basepasses.py:195\u001b[0m, in \u001b[0;36mTransformationPass.execute\u001b[0;34m(self, passmanager_ir, state, callback)\u001b[0m\n\u001b[1;32m 189\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mexecute\u001b[39m(\n\u001b[1;32m 190\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 191\u001b[0m passmanager_ir: PassManagerIR,\n\u001b[1;32m 192\u001b[0m state: PassManagerState,\n\u001b[1;32m 193\u001b[0m callback: Callable \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 194\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28mtuple\u001b[39m[PassManagerIR, PassManagerState]:\n\u001b[0;32m--> 195\u001b[0m new_dag, state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexecute\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 196\u001b[0m \u001b[43m \u001b[49m\u001b[43mpassmanager_ir\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpassmanager_ir\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 197\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstate\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 198\u001b[0m \u001b[43m \u001b[49m\u001b[43mcallback\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcallback\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 199\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 201\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m state\u001b[38;5;241m.\u001b[39mworkflow_status\u001b[38;5;241m.\u001b[39mprevious_run \u001b[38;5;241m==\u001b[39m RunState\u001b[38;5;241m.\u001b[39mSUCCESS:\n\u001b[1;32m 202\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(new_dag, DAGCircuit):\n\u001b[1;32m 203\u001b[0m \u001b[38;5;66;03m# Copy calibration data from the original program\u001b[39;00m\n",
"File \u001b[0;32m~/Documents/development/ai-and-data-public/qiskit-ibm-transpiler/.venv-qiskit-ibm-transpiler/lib/python3.11/site-packages/qiskit/passmanager/base_tasks.py:98\u001b[0m, in \u001b[0;36mGenericPass.execute\u001b[0;34m(self, passmanager_ir, state, callback)\u001b[0m\n\u001b[1;32m 96\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 97\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m state\u001b[38;5;241m.\u001b[39mworkflow_status\u001b[38;5;241m.\u001b[39mcompleted_passes:\n\u001b[0;32m---> 98\u001b[0m ret \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpassmanager_ir\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 99\u001b[0m run_state \u001b[38;5;241m=\u001b[39m RunState\u001b[38;5;241m.\u001b[39mSUCCESS\n\u001b[1;32m 100\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n",
"File \u001b[0;32m~/Documents/development/ai-and-data-public/qiskit-ibm-transpiler/qiskit_ibm_transpiler/ai/routing.py:122\u001b[0m, in \u001b[0;36mAIRouting.run\u001b[0;34m(self, dag)\u001b[0m\n\u001b[1;32m 119\u001b[0m measurements \u001b[38;5;241m=\u001b[39m [g \u001b[38;5;28;01mfor\u001b[39;00m g \u001b[38;5;129;01min\u001b[39;00m qc \u001b[38;5;28;01mif\u001b[39;00m g\u001b[38;5;241m.\u001b[39moperation\u001b[38;5;241m.\u001b[39mname \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmeasure\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[1;32m 120\u001b[0m qc\u001b[38;5;241m.\u001b[39mremove_final_measurements(inplace\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n\u001b[0;32m--> 122\u001b[0m routed_qc, init_layout, final_layout \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mservice\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrouting\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 123\u001b[0m \u001b[43m \u001b[49m\u001b[43mcircuit\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mqc\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 124\u001b[0m \u001b[43m \u001b[49m\u001b[43mcoupling_map\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbackend\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 125\u001b[0m \u001b[43m \u001b[49m\u001b[43moptimization_level\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43moptimization_level\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 126\u001b[0m \u001b[43m \u001b[49m\u001b[43mcheck_result\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 127\u001b[0m \u001b[43m \u001b[49m\u001b[43mlayout_mode\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlayout_mode\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 128\u001b[0m \u001b[43m \u001b[49m\u001b[43moptimization_preferences\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43moptimization_preferences\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 129\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 131\u001b[0m \u001b[38;5;66;03m# TODO: Improve this\u001b[39;00m\n\u001b[1;32m 132\u001b[0m nq \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mmax\u001b[39m(init_layout) \u001b[38;5;241m+\u001b[39m \u001b[38;5;241m1\u001b[39m\n",
"File \u001b[0;32m~/Documents/development/ai-and-data-public/qiskit-ibm-transpiler/qiskit_ibm_transpiler/wrappers/ai_local_routing.py:38\u001b[0m, in \u001b[0;36mAILocalRouting.routing\u001b[0;34m(self, circuit, coupling_map, optimization_level, check_result, layout_mode, optimization_preferences)\u001b[0m\n\u001b[1;32m 27\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mrouting\u001b[39m(\n\u001b[1;32m 28\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 29\u001b[0m circuit: QuantumCircuit,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 36\u001b[0m ] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 37\u001b[0m ):\n\u001b[0;32m---> 38\u001b[0m coupling_map_dists_array \u001b[38;5;241m=\u001b[39m \u001b[43mcoupling_map\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdistance_matrix\u001b[49m\u001b[38;5;241m.\u001b[39mastype(\u001b[38;5;28mint\u001b[39m)\u001b[38;5;241m.\u001b[39mtolist()\n\u001b[1;32m 39\u001b[0m coupling_map_n_qubits \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlen\u001b[39m(coupling_map_dists_array)\n\u001b[1;32m 41\u001b[0m \u001b[38;5;66;03m# Perform routing\u001b[39;00m\n",
"\u001b[0;31mAttributeError\u001b[0m: 'list' object has no attribute 'distance_matrix'"
"File \u001b[0;32m~/Documents/development/ai-and-data-public/qiskit-ibm-transpiler/qiskit_ibm_transpiler/ai/routing.py:122\u001b[0m, in \u001b[0;36mAIRouting.run\u001b[0;34m(self, dag)\u001b[0m\n\u001b[1;32m 117\u001b[0m measurements \u001b[38;5;241m=\u001b[39m [g \u001b[38;5;28;01mfor\u001b[39;00m g \u001b[38;5;129;01min\u001b[39;00m qc \u001b[38;5;28;01mif\u001b[39;00m g\u001b[38;5;241m.\u001b[39moperation\u001b[38;5;241m.\u001b[39mname \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmeasure\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[1;32m 118\u001b[0m qc\u001b[38;5;241m.\u001b[39mremove_final_measurements(inplace\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n\u001b[1;32m 120\u001b[0m routed_qc, init_layout, final_layout \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mservice\u001b[38;5;241m.\u001b[39mrouting(\n\u001b[1;32m 121\u001b[0m circuit\u001b[38;5;241m=\u001b[39mqc,\n\u001b[0;32m--> 122\u001b[0m coupling_map\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbackend\u001b[49m,\n\u001b[1;32m 123\u001b[0m optimization_level\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39moptimization_level,\n\u001b[1;32m 124\u001b[0m check_result\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[1;32m 125\u001b[0m layout_mode\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mlayout_mode,\n\u001b[1;32m 126\u001b[0m optimization_preferences\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39moptimization_preferences,\n\u001b[1;32m 127\u001b[0m )\n\u001b[1;32m 129\u001b[0m \u001b[38;5;66;03m# TODO: Improve this\u001b[39;00m\n\u001b[1;32m 130\u001b[0m nq \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mmax\u001b[39m(init_layout) \u001b[38;5;241m+\u001b[39m \u001b[38;5;241m1\u001b[39m\n",
"\u001b[0;31mAttributeError\u001b[0m: 'AIRouting' object has no attribute 'backend'"
]
}
],
Expand Down

0 comments on commit b31b5fc

Please sign in to comment.