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

fix the math module for autoray 0.7.0 #6429

Merged
merged 8 commits into from
Oct 23, 2024
Merged

fix the math module for autoray 0.7.0 #6429

merged 8 commits into from
Oct 23, 2024

Conversation

albi3ro
Copy link
Contributor

@albi3ro albi3ro commented Oct 22, 2024

Context:

Autoray has released a new version. This has caused failures with several tensorflow functions.

Description of the Change:

Patches tensorflow functions that are now longer working.

null.qubit no longer returns interface numbers unless we have gradient_method="backprop". This is necessary because null qubit was creating tensorflow arrays with the wrong precision. A device does not need to return interface data in any situation other than backprop. That conversion to the interface data type was unnecessary.

Benefits:

No more autoray version pinning.

Possible Drawbacks:

Related GitHub Issues:

Copy link
Contributor

@mudit2812 mudit2812 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.

We will no longer work with autoray < 0.7.0.

Why will autoray<0.7 stop working? We've only registered 2 new functions.

pennylane/math/single_dispatch.py Outdated Show resolved Hide resolved
tests/math/test_functions.py Show resolved Hide resolved
Copy link

codecov bot commented Oct 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.38%. Comparing base (9e1e08e) to head (3bf6fff).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6429   +/-   ##
=======================================
  Coverage   99.38%   99.38%           
=======================================
  Files         447      447           
  Lines       42429    42441   +12     
=======================================
+ Hits        42169    42181   +12     
  Misses        260      260           

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

@albi3ro albi3ro requested a review from mudit2812 October 22, 2024 20:32
@albi3ro
Copy link
Contributor Author

albi3ro commented Oct 22, 2024

[sc-76593]

@albi3ro albi3ro requested a review from a team October 22, 2024 21:24
Copy link
Contributor

@dwierichs dwierichs left a comment

Choose a reason for hiding this comment

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

Only had an optional suggestion to simplify the function registration for non-experimental tensorflow functions, and the idea to remove now redundant pointers to the experimental module that we added earlier.
Thanks for fixing this!

pennylane/devices/null_qubit.py Outdated Show resolved Hide resolved
pennylane/math/single_dispatch.py Outdated Show resolved Hide resolved
@albi3ro albi3ro merged commit 48bc1d1 into master Oct 23, 2024
40 checks passed
@albi3ro albi3ro deleted the autoray-fix branch October 23, 2024 14:29
mudit2812 pushed a commit that referenced this pull request Nov 11, 2024
**Context:**

Autoray has released a new version. This has caused failures with
several tensorflow functions.

**Description of the Change:**

Patches tensorflow functions that are now longer working.

`null.qubit` no longer returns interface numbers unless we have
`gradient_method="backprop"`. This is necessary because null qubit was
creating tensorflow arrays with the wrong precision. A device does not
need to return interface data in any situation other than backprop. That
conversion to the interface data type was unnecessary.

**Benefits:**

No more autoray version pinning.

**Possible Drawbacks:**

**Related GitHub Issues:**
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.

4 participants