-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fix bug causing slices with depth > 1 to be forward-prop'd #62
base: main
Are you sure you want to change the base?
Conversation
This is a bit tangential, but in adjusting the unit tests I realized this line should maybe be |
Pull Request Test Coverage Report for Build 13503277786Details
💛 - Coveralls |
I agree, it should be |
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.
These look good
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.
Just some minor comments, other than that, this LGTM 👍
@@ -164,7 +164,8 @@ def handle_timeout(signum, frame): | |||
# PERF: we will likely need to parallelize this loop | |||
for i in range(num_observables): | |||
non_trivial_slice = False | |||
for op_idx, op_node in enumerate(circuit_to_dag(slice_).topological_op_nodes()): | |||
op_nodes = reversed(list(circuit_to_dag(slice_).topological_op_nodes())) |
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.
Must we explicitly convert the iterator to a list? Or can we do the following instead?
op_nodes = reversed(list(circuit_to_dag(slice_).topological_op_nodes())) | |
op_nodes = reversed(circuit_to_dag(slice_).topological_op_nodes()) |
@@ -164,7 +164,8 @@ def handle_timeout(signum, frame): | |||
# PERF: we will likely need to parallelize this loop | |||
for i in range(num_observables): | |||
non_trivial_slice = False | |||
for op_idx, op_node in enumerate(circuit_to_dag(slice_).topological_op_nodes()): | |||
op_nodes = reversed(list(circuit_to_dag(slice_).topological_op_nodes())) | |||
for op_idx, op_node in enumerate(op_nodes): |
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.
Since this op_idx
now indexes the gates in the layer in reverse, I wonder whether we should update the log message where this gets used. Just to be super clear about this.
--- | ||
fixes: | ||
- | | ||
Fixed a bug in :func:`qiskit_addon_obp.backpropagate` which caused slices with depth > 1 to be incorrectly forward-propagated. |
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.
Can we be more explicit and state that gates within a slice will from now on be backpropagated properly, that is, in reverse order.
Fixes #60