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 return of single measurement in qfunc transform. #1434

Merged
merged 3 commits into from
Jun 25, 2021

Conversation

glassnotes
Copy link
Contributor

@glassnotes glassnotes commented Jun 25, 2021

Context: After applying a quantum function transform and constructing a QNode, the resultant QNode would return a 1-d array of measurement results even when there was only a single measurement.

Description of the Change: The qfunc transform decorator now checks the length of the list of measurements, and returns a list of results only when there are multiple measurements.

Benefits: Transformed QNodes that return a 0-d tensor now still return a 0-d tensor.

Possible Drawbacks: None

Related GitHub Issues: None

@github-actions
Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit .github/CHANGELOG.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@codecov
Copy link

codecov bot commented Jun 25, 2021

Codecov Report

Merging #1434 (284e65f) into master (a6a82ee) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1434   +/-   ##
=======================================
  Coverage   98.23%   98.23%           
=======================================
  Files         160      160           
  Lines       11964    11966    +2     
=======================================
+ Hits        11753    11755    +2     
  Misses        211      211           
Impacted Files Coverage Δ
pennylane/transforms/qfunc_transforms.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a6a82ee...284e65f. Read the comment docs.

@glassnotes glassnotes requested a review from josh146 June 25, 2021 15:10
Copy link
Member

@josh146 josh146 left a comment

Choose a reason for hiding this comment

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

Amazing, thanks @glassnotes!

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.

None yet

2 participants