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 bug where applying the Torch interface repeatedly after expansion caused an error #1223

Merged
merged 5 commits into from
Apr 16, 2021

Conversation

josh146
Copy link
Member

@josh146 josh146 commented Apr 16, 2021

Context: Applying the Torch interface, twice, to an expanded tape, resulted in an error. This is because the expand() function was not retaining the __bare__ attribute of the tape, which stores the original (pre-interface) class of the tape.

Description of the Change: The expand() method now retains the __bare__ attribute. A test has also been added.

Benefits: Fixes the aforementioned bug.

Possible Drawbacks: Not a drawback per se, just a note: once we remove tape subclasses (alongside gradient methods becoming transforms), we can remove the __bare__ attribute.

Related GitHub Issues: Closes #1210

.github/CHANGELOG.md Outdated Show resolved Hide resolved
@josh146 josh146 changed the title Fixes bug where repeated Torch interface after expansion caused an error Fixes bug where applying the Torch interface repeatedly after expansion caused an error Apr 16, 2021
@codecov
Copy link

codecov bot commented Apr 16, 2021

Codecov Report

Merging #1223 (3c9ef1e) into master (e55e42b) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1223   +/-   ##
=======================================
  Coverage   98.12%   98.12%           
=======================================
  Files         145      145           
  Lines       10985    10986    +1     
=======================================
+ Hits        10779    10780    +1     
  Misses        206      206           
Impacted Files Coverage Δ
pennylane/tape/tape.py 98.51% <100.00%> (+<0.01%) ⬆️

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 e55e42b...3c9ef1e. Read the comment docs.

Copy link
Contributor

@trbromley trbromley left a comment

Choose a reason for hiding this comment

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

Thanks @josh146! We can revert PennyLaneAI/qml#247 once this is merged in 🎉

.github/CHANGELOG.md Outdated Show resolved Hide resolved
josh146 and others added 2 commits April 16, 2021 22:24
Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>
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.

Repeated applications of the torch interface result in an error when using templates
2 participants