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

[Bugfix] Interface name variations dispatch to correct backprop device #2591

Merged
merged 6 commits into from
May 18, 2022

Conversation

albi3ro
Copy link
Contributor

@albi3ro albi3ro commented May 18, 2022

Fixes #2546

Now if you specify QNodes like:

qml.QNode(qfunc, qml.device('default.qubit', wires=1), interface="tensorflow", diff_method="backprop")

It will map the device to default.qubit.tf and using backpropagation instead of silently switching to a different diff_method.

In solving this bug, I substituted qml.interfaces.INTERFACE_MAP for qml.interfaces.INTERFACE_NAMES, which maps in the opposite direction. This allowed from some readability improvements. qml.interfaces.INTERFACE_MAP maps provided name to canonical name, instead of canonical name to list of acceptable provided names.

@albi3ro
Copy link
Contributor Author

albi3ro commented May 18, 2022

[sc-19268]

@codecov
Copy link

codecov bot commented May 18, 2022

Codecov Report

Merging #2591 (ff59961) into master (48636c5) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #2591   +/-   ##
=======================================
  Coverage   99.58%   99.58%           
=======================================
  Files         243      243           
  Lines       19595    19596    +1     
=======================================
+ Hits        19514    19515    +1     
  Misses         81       81           
Impacted Files Coverage Δ
pennylane/interfaces/__init__.py 100.00% <100.00%> (ø)
pennylane/interfaces/execution.py 100.00% <100.00%> (ø)
pennylane/qnode.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 48636c5...ff59961. Read the comment docs.

@albi3ro albi3ro requested a review from antalszava May 18, 2022 18:42
Copy link
Contributor

@antalszava antalszava left a comment

Choose a reason for hiding this comment

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

Looks good! 🎉 😻 Once the changelog entry is updated, good to merge this from my side.

doc/releases/changelog-dev.md Outdated Show resolved Hide resolved
pennylane/interfaces/execution.py Show resolved Hide resolved
@albi3ro albi3ro merged commit 0ac1c69 into master May 18, 2022
@albi3ro albi3ro deleted the passthru_devices_names branch May 18, 2022 20:01
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.

[BUG] Sub-devices for default.qubit are not used with variations of the interface name
2 participants