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

Tidy classical cotransform part of TransformProgram #6631

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

albi3ro
Copy link
Contributor

@albi3ro albi3ro commented Nov 25, 2024

Context:

When trying to improve the organization and structure of our workflow, one major blocker is being able to handle the classical cotransform and argnums component of the transform program. Right now we can't defer adding in the device transforms and gradient preprocessing till inside qml.execute, because we have to set the classical component of the transform program in the qnode.

One option I am considering is storing qnode, args, and kwargs on the program and lazily computing args and the classical component, instead of eagerily calculating the argnums and classical_cotransforms. This would allow us to setup the full transform program inside qml.execute, instead of the QNode.

The main blocker to making this change was understanding what the classical component was actually doing. While figuring that out, I rewrote some of the code to reduce nesting and reduce the amount going on in each individual component. Hopefully this makes it a little easier to understand.

Description of the Change:

Reduces the levels of nesting in TransformProgram._set_all_classical_jacobians to make it a little easier to understand.

Benefits:

In the future, it will be easier to move components around without breaking things.

Possible Drawbacks:

Maybe an unnecessary waste of time.

Related GitHub Issues:

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.

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.46%. Comparing base (828c1ec) to head (f4dad89).
Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6631   +/-   ##
=======================================
  Coverage   99.46%   99.46%           
=======================================
  Files         454      455    +1     
  Lines       42649    42702   +53     
=======================================
+ Hits        42420    42473   +53     
  Misses        229      229           

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

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.

1 participant