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

Add backwards compatibility to qml.generator() #2304

Closed
wants to merge 7 commits into from

Conversation

josh146
Copy link
Member

@josh146 josh146 commented Mar 11, 2022

Context:

  • In previous versions of PennyLane, Operator.generator was a property, that returned a list of the form [type, float] or [array, float].

  • In the current master, this has been changed. Operator.generator is now a method, and it returns an Operator instance.

  • In Add qml.generator(op) function #2256, a high-level qml.generator() function was added, intended to be the user-facing interface to Operator.generator().

Description of the Change: A small modification to qml.generator() has been made, to ensure it continues to work with old-style operators that define the Operator.generator property. In addition, a deprecation warning is raised.

Benefits: qml.generator() should work with old-style operators.

Possible Drawbacks: This backwards compatibility is constrained, in that it requires developers start using qml.generator, a new function!

Related GitHub Issues: n/a

@josh146 josh146 added the review-ready 👌 PRs which are ready for review by someone from the core team. label Mar 11, 2022
@github-actions
Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@codecov
Copy link

codecov bot commented Mar 11, 2022

Codecov Report

❗ No coverage uploaded for pull request base (v0.22.0-rc0@78447d0). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head f113d1f differs from pull request most recent head cee4c03. Consider uploading reports for the commit cee4c03 to get more accurate results

Impacted file tree graph

@@              Coverage Diff               @@
##             v0.22.0-rc0    #2304   +/-   ##
==============================================
  Coverage               ?   99.31%           
==============================================
  Files                  ?      241           
  Lines                  ?    19103           
  Branches               ?        0           
==============================================
  Hits                   ?    18972           
  Misses                 ?      131           
  Partials               ?        0           

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 78447d0...cee4c03. Read the comment docs.

@josh146 josh146 changed the base branch from master to v0.22.0-rc0 March 11, 2022 09:22
@josh146 josh146 closed this Mar 11, 2022
@josh146 josh146 deleted the generator-fix branch March 11, 2022 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review-ready 👌 PRs which are ready for review by someone from the core team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants