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 primitives metadata #9285

Merged
merged 7 commits into from
Dec 20, 2022
Merged

Fix primitives metadata #9285

merged 7 commits into from
Dec 20, 2022

Conversation

ElePT
Copy link
Contributor

@ElePT ElePT commented Dec 14, 2022

Summary

jschuhmac developed a custom estimator for his research project where additional metadata is saved, and realized that all values were updated with each iteration because the list of dicts was instantiated by reference. This PR fixes the reference Sampler and Estimator classes to avoid this problem.

Details and comments

Given that the only metadata currently saved are shots, and they don't change between circuits, it is not possible to add a unit test with this implementation, but I think this fix is good to have in case anyone wants to extend these classes and save different metadata.

ElePT and others added 2 commits December 14, 2022 10:52
Co-authored-by: Julian Schuhmacher <jsc@zurich.ibm.com>
@ElePT ElePT requested review from a team, ikkoham and t-imamichi as code owners December 14, 2022 10:29
@qiskit-bot
Copy link
Collaborator

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:

@coveralls
Copy link

coveralls commented Dec 14, 2022

Pull Request Test Coverage Report for Build 3742930238

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

Totals Coverage Status
Change from base Build 3742904434: 0%
Covered Lines: 63659
Relevant Lines: 75302

💛 - Coveralls

@Cryoris
Copy link
Contributor

Cryoris commented Dec 14, 2022

LGTM! I would agree that this is straightforward enough to merge without a dedicated test, but let's hold merging off for a bit in case there are concerns.

@woodsp-ibm woodsp-ibm added Changelog: Bugfix Include in the "Fixed" section of the changelog mod: primitives Related to the Primitives module labels Dec 14, 2022
t-imamichi
t-imamichi previously approved these changes Dec 14, 2022
Copy link
Member

@t-imamichi t-imamichi left a comment

Choose a reason for hiding this comment

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

LGTM

ikkoham
ikkoham previously approved these changes Dec 19, 2022
Copy link
Contributor

@ikkoham ikkoham left a comment

Choose a reason for hiding this comment

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

Thank you. LGTM!

@ElePT ElePT dismissed stale reviews from ikkoham and t-imamichi via ee36d4e December 19, 2022 11:48
ElePT and others added 2 commits December 19, 2022 15:55
Co-authored-by: Ikko Hamamura <ikkoham@users.noreply.github.com>
@mergify mergify bot merged commit 1caf030 into Qiskit:main Dec 20, 2022
Cryoris added a commit to Cryoris/qiskit-terra that referenced this pull request Jan 12, 2023
* Fix bug metadata

Co-authored-by: Julian Schuhmacher <jsc@zurich.ibm.com>

* Add reno

* Re-trigger CI

* Fix typo

Co-authored-by: Ikko Hamamura <ikkoham@users.noreply.github.com>

Co-authored-by: Julian Schuhmacher <jsc@zurich.ibm.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Ikko Hamamura <ikkoham@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog mod: primitives Related to the Primitives module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants