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

Fix bug causing slices with depth > 1 to be forward-prop'd #62

Merged
merged 8 commits into from
Mar 5, 2025

Conversation

caleb-johnson
Copy link
Collaborator

Fixes #60

@caleb-johnson
Copy link
Collaborator Author

This is a bit tangential, but in adjusting the unit tests I realized this line should maybe be >=? We should be able to use 100% of the budget -- not strictly less, right?

@coveralls
Copy link

coveralls commented Feb 24, 2025

Pull Request Test Coverage Report for Build 13681086388

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 13182974064: 0.0%
Covered Lines: 432
Relevant Lines: 432

💛 - Coveralls

@BryceFuller
Copy link
Contributor

This is a bit tangential, but in adjusting the unit tests I realized this line should maybe be >=? We should be able to use 100% of the budget -- not strictly less, right?

I agree, it should be >= . While double checking, I also noticed that the condition of the while loop checks equality between two floats with !=, that should be using np.isclose()

Copy link
Contributor

@BryceFuller BryceFuller left a comment

Choose a reason for hiding this comment

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

These look good

Copy link
Member

@mrossinek mrossinek left a 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 = list(circuit_to_dag(slice_).topological_op_nodes())[::-1]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mrossinek I'll just cast to list here and reverse it. That way I can get its length for logger

Copy link
Member

Choose a reason for hiding this comment

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

I guess that is fine. Although I think it would have been fine if the logger counted forwards

Copy link
Collaborator Author

@caleb-johnson caleb-johnson Mar 6, 2025

Choose a reason for hiding this comment

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

Well reversed cant act on a generator, so it was going to need to be cast either way in order to iterate backwards (as far as I can tell, at least). We can adjust the logger before release if you want it to behave differently

Copy link
Member

Choose a reason for hiding this comment

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

I was thinking we could do:

enumerate(reversed(...))

But as I said, it is not a big deal 👍

@caleb-johnson caleb-johnson merged commit ea445b3 into main Mar 5, 2025
15 checks passed
@caleb-johnson caleb-johnson deleted the slice-bug branch March 6, 2025 15:16
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.

Operators are forward-propagated through depth >1 slices
4 participants