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

specs can be requested at a specific stage of the transform program #5781

Merged
merged 20 commits into from
Jun 17, 2024

Conversation

Shiro-Raven
Copy link
Contributor

@Shiro-Raven Shiro-Raven commented May 31, 2024

Context:
Currently, specs() can only be requested after applying the full transform program, with the exception of the stages provided through expansion_strategy.

Description of the Change:
Using the new level argument from construct_batch, the function is adapted to make use of the argument as well, which allows for more flexible requests and ability to pinpoint when exactly to ask for specs. In addition, the function works with transforms that split the tape, returning a list of dictionaries each corresponding to one of the new tapes.

Benefits:
More flexible resource estimation.

[sc-53736] Fixes #5706

@albi3ro albi3ro requested a review from Jaybsoni May 31, 2024 20:57
Copy link

codecov bot commented May 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.67%. Comparing base (1bf7682) to head (4046c97).
Report is 247 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5781      +/-   ##
==========================================
- Coverage   99.68%   99.67%   -0.01%     
==========================================
  Files         421      421              
  Lines       40437    40139     -298     
==========================================
- Hits        40309    40009     -300     
- Misses        128      130       +2     

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

@Shiro-Raven Shiro-Raven requested a review from albi3ro June 3, 2024 15:21
Copy link
Contributor

@albi3ro albi3ro left a comment

Choose a reason for hiding this comment

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

🎉 Glad for this to finally be getting finished up!

pennylane/resource/specs.py Show resolved Hide resolved
pennylane/resource/specs.py Show resolved Hide resolved
@mudit2812 mudit2812 removed their request for review June 5, 2024 15:36
Copy link
Contributor

@Jaybsoni Jaybsoni left a comment

Choose a reason for hiding this comment

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

Great work, I can't wait to play around with this feature myself! I left a few small changes to be addressed.

Additionally, I found a bug! When passing in level = "device", we lose the error key of the specs dictionary. This is because we compute the error on the decomposed tape, but the error is only defined for templates which get decomposed into fundamental gates. I can share an example of this with you offline and we can discuss how best to support it !

pennylane/resource/specs.py Show resolved Hide resolved
pennylane/resource/specs.py Show resolved Hide resolved
pennylane/resource/specs.py Outdated Show resolved Hide resolved
pennylane/resource/specs.py Outdated Show resolved Hide resolved
Copy link
Contributor

@Jaybsoni Jaybsoni left a comment

Choose a reason for hiding this comment

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

Great work!

@Shiro-Raven Shiro-Raven enabled auto-merge (squash) June 17, 2024 18:34
@Shiro-Raven Shiro-Raven merged commit 94adc17 into master Jun 17, 2024
40 checks passed
@Shiro-Raven Shiro-Raven deleted the ad/specs-at-any-stage branch June 17, 2024 19:28
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.

[BUG] Specs does not take into account transforms
5 participants