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

Raise an error if adjoint is applied to a non-callable object. #2060

Merged
merged 4 commits into from
Jan 7, 2022

Conversation

dwierichs
Copy link
Contributor

@dwierichs dwierichs commented Dec 22, 2021

Context:
This implements #1336

Description of the Change:
The object that qml.adjoint is applied to is checked to be callable before constructing the transform.

Benefits:
Catches scenarios in which qml.adjoint would silently simply do nothing.

Possible Drawbacks:
n/a

Related GitHub Issues:
closes #1336

@codecov
Copy link

codecov bot commented Dec 22, 2021

Codecov Report

Merging #2060 (e6f1be0) into master (7092213) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2060   +/-   ##
=======================================
  Coverage   99.18%   99.18%           
=======================================
  Files         226      226           
  Lines       17368    17370    +2     
=======================================
+ Hits        17226    17229    +3     
+ Misses        142      141    -1     
Impacted Files Coverage Δ
pennylane/transforms/adjoint.py 100.00% <100.00%> (ø)
pennylane/tape/tape.py 99.21% <0.00%> (+0.26%) ⬆️

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 7092213...e6f1be0. Read the comment docs.

@josh146 josh146 added the bug 🐛 Something isn't working label Dec 23, 2021
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.

Thanks @dwierichs!

@dwierichs dwierichs merged commit 1f3cce2 into master Jan 7, 2022
@dwierichs dwierichs deleted the warning-silent-adjoint-miss branch January 7, 2022 11:18
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.

Raise exception or warning when qml.adjoint is used on operation list instead of function.
2 participants