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

DeprecateQNode.gradient_fn #6244

Merged
merged 14 commits into from
Sep 12, 2024
Merged

DeprecateQNode.gradient_fn #6244

merged 14 commits into from
Sep 12, 2024

Conversation

albi3ro
Copy link
Contributor

@albi3ro albi3ro commented Sep 9, 2024

Context:

The existence of QNode.gradient_fn ties us in to a bit more of an object oriented framework with a lot of in-place mutation of the qnode. By freeing ourselves from this property, we can have a bit more of a functional structure with less coupling and side effects. It will also free us up to start making other logical changes and improvements.

QNode.gradient_fn is also not really defined, so it's hard to tell what it should actually be and reflect. Things have changed enough recently with more dynamic gradient validation, that it no longer really carries the same information it did when it was added.

There isn't really a good analog yet of QNode.gradient_fn, since it's kinda a "processed diff method". We do have stories for next quarter to start adding helper transforms for things like this, but it won't be immediate.

Description of the Change:

Benefits:

Possible Drawbacks:

Related GitHub Issues:

[sc-71844]

Copy link
Contributor

@lillian542 lillian542 left a comment

Choose a reason for hiding this comment

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

Just a couple of questions :)

pennylane/workflow/qnode.py Outdated Show resolved Hide resolved
Copy link
Contributor

@PietropaoloFrisoni PietropaoloFrisoni left a comment

Choose a reason for hiding this comment

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

Cool, just one comment from me (except for the tests)

doc/development/deprecations.rst Outdated Show resolved Hide resolved
Copy link

codecov bot commented Sep 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.59%. Comparing base (62b1f06) to head (031a73e).
Report is 345 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6244   +/-   ##
=======================================
  Coverage   99.59%   99.59%           
=======================================
  Files         444      444           
  Lines       42307    42307           
=======================================
  Hits        42137    42137           
  Misses        170      170           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

albi3ro and others added 2 commits September 10, 2024 17:43
Co-authored-by: Pietropaolo Frisoni <pietropaolo.frisoni@xanadu.ai>
@albi3ro albi3ro requested a review from lillian542 September 12, 2024 13:58
Copy link
Contributor

@lillian542 lillian542 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 to me :)

@albi3ro albi3ro enabled auto-merge (squash) September 12, 2024 21:30
@albi3ro albi3ro disabled auto-merge September 12, 2024 21:48
@albi3ro albi3ro merged commit 30331fd into master Sep 12, 2024
35 checks passed
@albi3ro albi3ro deleted the deprecate-qnode-gradient-fn branch September 12, 2024 21:48
mudit2812 pushed a commit that referenced this pull request Sep 16, 2024
**Context:**

The existence of `QNode.gradient_fn` ties us in to a bit more of an
object oriented framework with a lot of in-place mutation of the qnode.
By freeing ourselves from this property, we can have a bit more of a
functional structure with less coupling and side effects. It will also
free us up to start making other logical changes and improvements.

`QNode.gradient_fn` is also not really defined, so it's hard to tell
what it should actually be and reflect. Things have changed enough
recently with more dynamic gradient validation, that it no longer really
carries the same information it did when it was added.

There isn't really a good analog yet of `QNode.gradient_fn`, since it's
kinda a "processed diff method". We do have stories for next quarter to
start adding helper transforms for things like this, but it won't be
immediate.

**Description of the Change:**

**Benefits:**

**Possible Drawbacks:**

**Related GitHub Issues:**

[sc-71844]

---------

Co-authored-by: Pietropaolo Frisoni <pietropaolo.frisoni@xanadu.ai>
mudit2812 pushed a commit that referenced this pull request Sep 23, 2024
**Context:**

The existence of `QNode.gradient_fn` ties us in to a bit more of an
object oriented framework with a lot of in-place mutation of the qnode.
By freeing ourselves from this property, we can have a bit more of a
functional structure with less coupling and side effects. It will also
free us up to start making other logical changes and improvements.

`QNode.gradient_fn` is also not really defined, so it's hard to tell
what it should actually be and reflect. Things have changed enough
recently with more dynamic gradient validation, that it no longer really
carries the same information it did when it was added.

There isn't really a good analog yet of `QNode.gradient_fn`, since it's
kinda a "processed diff method". We do have stories for next quarter to
start adding helper transforms for things like this, but it won't be
immediate.

**Description of the Change:**

**Benefits:**

**Possible Drawbacks:**

**Related GitHub Issues:**

[sc-71844]

---------

Co-authored-by: Pietropaolo Frisoni <pietropaolo.frisoni@xanadu.ai>
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.

3 participants