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

Add RemoveFinalReset pass #11266

Merged
merged 8 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions releasenotes/notes/remove-final-reset-488247c01c4e147d.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,3 @@ features:
qc.measure(0, 0)
qc.reset(range(3))
RemoveFinalReset()(qc).draw("mpl")

This new pass is enabled at optimization levels 1 and higher.
9 changes: 6 additions & 3 deletions test/python/transpiler/test_remove_final_reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
import unittest

from qiskit import QuantumRegister, QuantumCircuit
from qiskit.passmanager.flow_controllers import DoWhileController
from qiskit.transpiler import PassManager
from qiskit.transpiler.passes import RemoveFinalReset, DAGFixedPoint
from qiskit.converters import circuit_to_dag
from qiskit.test import QiskitTestCase
from test import QiskitTestCase # pylint: disable=wrong-import-order
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, you could make pylint happy if you added a new line between the qiskit import section and this import.



class TestRemoveFinalReset(QiskitTestCase):
Expand Down Expand Up @@ -102,8 +103,10 @@ def test_two_resets(self):

pass_manager = PassManager()
pass_manager.append(
[RemoveFinalReset(), DAGFixedPoint()],
do_while=lambda property_set: not property_set["dag_fixed_point"],
DoWhileController(
[RemoveFinalReset(), DAGFixedPoint()],
do_while=lambda property_set: not property_set["dag_fixed_point"],
)
)
after = pass_manager.run(circuit)

Expand Down
Loading