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

Keyword argument bug fixes #206

Merged
merged 3 commits into from May 22, 2019

Conversation

Projects
None yet
2 participants
@josh146
Copy link
Member

commented May 21, 2019

Description of the Change:

This PR fixes two bugs noted in https://discuss.pennylane.ai/t/passing-non-differentiable-arguments-to-qnode/135/5:

  1. When QNode keyword arguments are used to specify wires of operations/expvals, complicated casting rules can cause them to be of type np.int64 rather than the standard Python type int. This can cause issues with external plugin devices, for example, if the targeted framework performs validation to ensure that isinstance(qubit, int).

    To fix this, we explicitly cast the operation wires directly to integers in Operation.wires.

  2. There is a typo in the qubit rotation tutorial; the line

    PennyLane does differentiate QNodes with respect to keyword arguments,
    so they are useful for passing external data to your QNode.

    should instead say

    PennyLane does not differentiate QNodes with respect to keyword arguments,
    so they are useful for passing external data to your QNode.

Benefits: Avoids exceptions occurring during supported behviour in some plugins.

Possible Drawbacks: None.

Related GitHub Issues: n/a

josh146 added some commits May 21, 2019

@josh146 josh146 requested review from co9olguy, smite and quantshah May 21, 2019

@codecov

This comment has been minimized.

Copy link

commented May 21, 2019

Codecov Report

Merging #206 into master will not change coverage.
The diff coverage is 100%.

@@          Coverage Diff          @@
##           master   #206   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          28     28           
  Lines        1689   1689           
=====================================
  Hits         1689   1689
Impacted Files Coverage Δ
pennylane/operation.py 100% <100%> (ø) ⬆️

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 be468c9...137d174. Read the comment docs.

@josh146 josh146 merged commit 504c58d into master May 22, 2019

5 checks passed

CodeFactor No issues found.
Details
Travis CI - Branch Build Passed
Details
Travis CI - Pull Request Build Passed
Details
codecov/patch 100% of diff hit (target 100%)
Details
codecov/project 100% (+0%) compared to be468c9
Details

@josh146 josh146 deleted the bug_fix_keyword_wires branch May 22, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.