-
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
transpile() always returns a circuit not in a list whether or not the input is a circuit in a list #5260
Comments
It seems to me the current behavior is intentional: However, I agree with you that it is counterintuitive. Fixing it is kind of trivial. But maybe we should try to understand deeper why it is currently like this. @ajavadia @kdk ? |
From #2166, it looks like the intent was to support both
and
so I think returning a length-1 list for a length-1 list input is consistent. |
I think the problem is that |
) * PassManager.run: preserve input signature for length 1 list Closes Qiskit#9798 * test/transpiler: consolidate regression tests for Qiskit#5260 and Qiskit#9798
) * PassManager.run: preserve input signature for length 1 list Closes Qiskit#9798 * test/transpiler: consolidate regression tests for Qiskit#5260 and Qiskit#9798
) * PassManager.run: preserve input signature for length 1 list Closes Qiskit#9798 * test/transpiler: consolidate regression tests for Qiskit#5260 and Qiskit#9798
Information
What is the current behavior?
When you run transpile function with a circuit list of only one circuit, then the output is the circuit, not the circuit in a list.
Steps to reproduce the problem
from qiskit import *
new_qc = transpile([qc], backend) #for some circuit qc and backend
new_qc
What is the expected behavior?
Right now, new_qc would produce a circuit not in a list, but I think it would be helpful if it would result as a list.
Suggested solutions
One suggested solution is to make a new variable in the transpile function called list_boolean, or something else, which would keep track of whether the input is a list or not, and in the conditional where the input list is length 1, one can check the value of list_boolean and if it is true, it returns the transpiled circuit in a list, and if false, it just returns the circuit.
The text was updated successfully, but these errors were encountered: