-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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: QNSPSA with max_evals_grouped exceeding 1 #9182
Conversation
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the the following people are requested to review this:
|
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.
The logic here all looks correct to me, thanks.
values_x = np.reshape(values_x, (-1, num_parameters)).tolist() | ||
batch_size_x = len(values_x) | ||
|
||
values_y = np.reshape(values_y, (-1, num_parameters)).tolist() | ||
batch_size_y = len(values_y) |
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.
Do the primitives not accept Numpy array inputs for parameters? That seems a bit unusual, but this is fine if they don't.
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.
That's probably my bad, we used that in the (Sampling)VQE but actually the primitives just need Sequence[Sequence[float]]
which should work with 2d numpy arrays 🙂
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.
Numpy arrays aren't technically Sequence
because they don't implement the methods index
and count
- it's an unfortunate implication from the collections.abc
module defining explicit mixin methods as part of the interface, and (as far as I know), there's no built-in Python type that implies the existence of the core iterable/sequence methods, but not the ones with generic definitions.
Pull Request Test Coverage Report for Build 3531644067
💛 - Coveralls |
Co-authored-by: Julien Gacon <gaconju@gmail.com>
a57d8cd
to
a98ea80
Compare
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.
Looks good to me, thanks!
Co-authored-by: Julien Gacon <gaconju@gmail.com> Co-authored-by: Julien Gacon <gaconju@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 324c875)
Co-authored-by: Julien Gacon <gaconju@gmail.com> Co-authored-by: Julien Gacon <gaconju@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 324c875) Co-authored-by: Max Rossmannek <oss@zurich.ibm.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com> Co-authored-by: Julien Gacon <gaconju@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com> Co-authored-by: Julien Gacon <gaconju@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com> Co-authored-by: Julien Gacon <gaconju@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Summary
Fixes a bug with QNSPSA when
max_evals_grouped
exceeds 1Details and comments