Skip to content
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

Bugfix: Error when uploading some circuits to TorchQuantum #208

Merged
merged 2 commits into from
Oct 20, 2023

Conversation

Vivekyy
Copy link
Contributor

@Vivekyy Vivekyy commented Oct 17, 2023

Fixes bug with importing transpiled circuits which are mapped trivially (resulting in a set initial_layout but a null final_layout). This will come up often on circuits that are transpiled with optimization_level=0, though this can happen on any level of optimization if the trivial layout happens to be optimal.

Code to replicate the bug:
`
from torchquantum.plugins import qiskit2tq

from qiskit.circuit.library import RealAmplitudes
from qiskit.compiler import transpile

from qiskit.providers.fake_provider import FakeGuadalupe

backend = FakeGuadalupe()

ansatz = RealAmplitudes(2, reps=1)
ansatz = transpile(ansatz, backend, optimization_level=0)

params = [0]*len(ansatz.parameters)
ansatz = ansatz.bind_parameters(params)

tq_layer = qiskit2tq(ansatz)
`

Hanrui-Wang and others added 2 commits October 5, 2023 15:35
… (resulting in a set initial_layout but a null final_layout)
@Hanrui-Wang
Copy link
Collaborator

Hi Vivekyy,

Thank you for your contributions! Merged!

@Hanrui-Wang Hanrui-Wang changed the base branch from main to dev October 20, 2023 14:27
@Hanrui-Wang Hanrui-Wang merged commit 07c3dd3 into mit-han-lab:dev Oct 20, 2023
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants