-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
initial_layout or circuit._layout bug #3851
Comments
|
Let me clarify it here. I wanted to test whether the transpiled circuit "trans_qc" changes if I transpile it again with the same initial_layout. I derived the initial layout from the transpiled circuit "trans_qc" And transpiled it again: But this will raise an error. |
An "embed circuit" does not have a layout. I think you can reach your goal by running This questions raises many thoughts:
|
I see. Is there any function/method that I can use to get the physical layout allocation rather than reading the printed circuits? It is difficult to manually check the figures. I thought trans_qc._layout should return the physical layout, but the result doesn't match with the printed circuit. |
The property
That means that the original |
Thanks for @1ucian0 's explanation. There are two things that confused me:
This is not a bug and I will close it. |
Information
What is the current behavior?
I tried to transpile the same circuit without and with initial_layout but the transpiler is returning an error message:
KeyError: "The item Qubit(QuantumRegister(20, 'q'), 0) does not exist in the Layout"
Steps to reproduce the problem
qr = QuantumRegister(3)
cr = ClassicalRegister(3)
qc = QuantumCircuit(qr, cr)
qc.cx(qr[0], qr[2])
qc.cx(qr[1], qr[2])
qc.measure(qr, cr)
trans_qc = transpile(qc, device)
ini_layout = trans_qc._layout.get_virtual_bits()
trans_qc2 = transpile(trans_qc, backend=device, initial_layout = ini_layout)
What is the expected behavior?
The initial layout is derived from the same circuit so the transpiler should return the same circuit.
Suggested solutions
The text was updated successfully, but these errors were encountered: