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 run_batch results format for SimulatedLocalProcessor #5026

Merged
merged 5 commits into from
Feb 25, 2022

Conversation

dstrain115
Copy link
Collaborator

  • batch_results returns a list of list of results
  • results should return a flattened list.
  • It used to just return the first result, it now returns
    all results in a flattened format.
  • Also, noticed that run_batch did not work in async mode. Fixed that.

- batch_results returns a list of list of results
- results should return a flattened list.
- It used to just return the first result, it now returns
all results in a flattened format.
- Also, noticed that run_batch did not work in async mode.  Fixed that.
@dstrain115 dstrain115 requested a review from dabacon February 25, 2022 13:41
@CirqBot CirqBot added the size: M 50< lines changed <250 label Feb 25, 2022
Comment on lines 121 to 127
if batch_size == 1:
program = parent.get_circuit()
results = self._sampler.run_sweep(
program=program, params=sweeps[0] if sweeps else None, repetitions=reps
)
self._state = quantum.enums.ExecutionStatus.State.SUCCESS
return [results]
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you not just run_batch with one program? That is, why do you need these two if cases?

Copy link
Collaborator

@mpharrigan mpharrigan left a comment

Choose a reason for hiding this comment

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

thanks for the quick fix

@dstrain115 dstrain115 merged commit 853dde3 into quantumlib:master Feb 25, 2022
95-martin-orion pushed a commit to 95-martin-orion/Cirq that referenced this pull request Mar 2, 2022
…5026)

* Fix run_batch results format for SimulatedLocalProcessor

- batch_results returns a list of list of results
- results should return a flattened list.
- It used to just return the first result, it now returns
all results in a flattened format.
- Also, noticed that run_batch did not work in async mode.  Fixed that.
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
…5026)

* Fix run_batch results format for SimulatedLocalProcessor

- batch_results returns a list of list of results
- results should return a flattened list.
- It used to just return the first result, it now returns
all results in a flattened format.
- Also, noticed that run_batch did not work in async mode.  Fixed that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: M 50< lines changed <250
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants