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

Fixes vector-Hessian product bug #1436

Merged
merged 4 commits into from
Jul 1, 2021
Merged

Fixes vector-Hessian product bug #1436

merged 4 commits into from
Jul 1, 2021

Conversation

josh146
Copy link
Member

@josh146 josh146 commented Jun 28, 2021

Context: The existing parameter-shift Hessian implementation returns incorrect Hessians for cost functions that perform post-processing on a vector-valued QNode.

Description of the Change:

  • The bug was fixed in all three main interfaces (autograd, PyTorch, TF), by making sure that the vector-Hessian product is divided by the norm squared of dy.

  • Tests were added for all three interfaces to ensure that this bug is fixed.

Benefits: Fixes the aforementioned bug.

Possible Drawbacks: n/a

Related GitHub Issues: Fixes #1424

@josh146 josh146 added the bug 🐛 Something isn't working label Jun 28, 2021
@josh146 josh146 requested a review from albi3ro June 28, 2021 16:56
@josh146 josh146 changed the title changelog Fixes vector-Hessian product bug Jun 28, 2021
@codecov
Copy link

codecov bot commented Jun 28, 2021

Codecov Report

Merging #1436 (572443c) into master (fe71ae0) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1436   +/-   ##
=======================================
  Coverage   98.24%   98.24%           
=======================================
  Files         160      160           
  Lines       12016    12016           
=======================================
  Hits        11805    11805           
  Misses        211      211           
Impacted Files Coverage Δ
pennylane/interfaces/tf.py 97.43% <ø> (ø)
pennylane/interfaces/torch.py 100.00% <ø> (ø)
pennylane/interfaces/autograd.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 fe71ae0...572443c. Read the comment docs.

Copy link
Contributor

@albi3ro albi3ro left a comment

Choose a reason for hiding this comment

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

Thanks!

Reproduced it locally and the bug is gone.

Can't see anything particular to comment on.

@josh146 josh146 merged commit 2623fcd into master Jul 1, 2021
@josh146 josh146 deleted the fix_hessian branch July 1, 2021 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parameter-shift Hessian of multi-observable circuits incorrect
3 participants