-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Replace SwapPermutationReplacer
with cirq.map_operations
#5655
Conversation
@@ -307,7 +297,7 @@ def compile_circuit( | |||
# as well, we allow this to be passed in. This compiler is not allowed to | |||
# change the order of the qubits. | |||
return CompilationResult( | |||
circuit=compiler(swap_networks[0].circuit), mapping=mapping, parity_map=parity_map |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was swap_networks[0].circuit
being passed in in the first place instead of routed_circuit
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the original optimizer mutated the circuit. routed_circuit
was a variable storing a reference to swap_networks[0].circuit
and since the underlying circuit was being mutated; it didn't matter whether you pass swap_networks[0].circuit
or routed_circuit
.
Now, routed_circuit
stores a modified copy of swap_networks[0].circuit
and therefore we need to pass routed_circuit
instead of swap_networks[0].circuit
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Part of #5028
Since
SwapPermutationReplacer
is not exposed outside the file, we don't need to go through the deprecation cycle