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

qml.layer support for tensorflow Variable #1615

Merged
merged 7 commits into from
Aug 31, 2021
Merged

qml.layer support for tensorflow Variable #1615

merged 7 commits into from
Aug 31, 2021

Conversation

albi3ro
Copy link
Contributor

@albi3ro albi3ro commented Aug 31, 2021

Fixes #1611

qml.layer used len to validate the length of the input argument, but tensorflow tf.Variable objects do not support calculation of len. Instead we use qml.math.shape(arg)[0] to allow the template to support all interfaces.

@albi3ro albi3ro added the bug 🐛 Something isn't working label Aug 31, 2021
@codecov
Copy link

codecov bot commented Aug 31, 2021

Codecov Report

Merging #1615 (27cb06a) into master (7709406) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1615   +/-   ##
=======================================
  Coverage   99.13%   99.13%           
=======================================
  Files         196      196           
  Lines       14158    14159    +1     
=======================================
+ Hits        14036    14037    +1     
  Misses        122      122           
Impacted Files Coverage Δ
pennylane/templates/layer.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 7709406...27cb06a. Read the comment docs.

@antalszava antalszava removed their request for review August 31, 2021 17:43
@albi3ro albi3ro requested a review from rmoyard August 31, 2021 17:55
Copy link
Contributor

@rmoyard rmoyard 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 @albi3ro , it looks good to me 👍 Just a small comment to add for the test.

tests/templates/test_layer.py Show resolved Hide resolved
albi3ro and others added 2 commits August 31, 2021 20:34
Co-authored-by: Romain <rmoyard@gmail.com>
@albi3ro albi3ro merged commit 9b46b55 into master Aug 31, 2021
@albi3ro albi3ro deleted the bugfix-layer-tf branch August 31, 2021 19: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.

[BUG] QAOA layer template does not work with TensorFlow
2 participants