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

Make qml.math.jax_argnums_to_tape_trainable private #6609

Merged
merged 6 commits into from
Nov 20, 2024

Conversation

albi3ro
Copy link
Contributor

@albi3ro albi3ro commented Nov 19, 2024

Context:

The math module should only depend on autoray, numpy, and all the various ML frameworks.

We have one method though, jax_argnums_to_tape_trainable, that introduces a qnode dependency into the math module. This function is only used in transform_program.py as an implementation detail.

Description of the Change:

Moves jax_argnums_to_tape_trainable to transform_program.py and makes it private.

Benefits:

Cleaner dependency tree in pennylane.

Possible Drawbacks:

It could technically be considered a breaking change, but I really don't think such a function needs to be part of the public math interface. If we really wanted to make it part of the official math interface, we should have at least tested it.

Related GitHub Issues:

Copy link

codecov bot commented Nov 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.45%. Comparing base (c9af833) to head (5b1781d).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6609      +/-   ##
==========================================
- Coverage   99.45%   99.45%   -0.01%     
==========================================
  Files         450      450              
  Lines       42088    42087       -1     
==========================================
- Hits        41857    41856       -1     
  Misses        231      231              

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


🚨 Try these New Features:

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.

Thanks, nice cleanup ! 😍

pennylane/transforms/core/transform_program.py Outdated Show resolved Hide resolved
@albi3ro albi3ro enabled auto-merge (squash) November 20, 2024 16:52
@albi3ro albi3ro merged commit 1c877d7 into master Nov 20, 2024
46 checks passed
@albi3ro albi3ro deleted the move-jax-argnums-to-tape-trainable branch November 20, 2024 17:19
astralcai pushed a commit that referenced this pull request Nov 20, 2024
**Context:**

The `math` module should only depend on autoray, numpy, and all the
various ML frameworks.

We have one method though, `jax_argnums_to_tape_trainable`, that
introduces a qnode dependency into the math module. This function is
only used in `transform_program.py` as an implementation detail.

**Description of the Change:**

Moves `jax_argnums_to_tape_trainable` to `transform_program.py` and
makes it private.

**Benefits:**

Cleaner dependency tree in pennylane.

**Possible Drawbacks:**

It could technically be considered a breaking change, but I really don't
think such a function needs to be part of the public `math` interface.
If we really wanted to make it part of the official `math` interface, we
should have at least tested it.

**Related GitHub Issues:**

---------

Co-authored-by: Pietropaolo Frisoni <[email protected]>
Co-authored-by: David Wierichs <[email protected]>
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