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

Add count_resources function #3996

Merged
merged 41 commits into from
Apr 19, 2023
Merged

Add count_resources function #3996

merged 41 commits into from
Apr 19, 2023

Conversation

Jaybsoni
Copy link
Contributor

Context:
Add a function which takes a tape and counts the resources used in the tape to return a Resources object

Description of the Change:
Add a function in resources.py which iterates over the operations in the tape along with additional meta-data
to count the resources for the tape.

@Jaybsoni
Copy link
Contributor Author

[sc-36750]

@github-actions
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.

@codecov
Copy link

codecov bot commented Apr 13, 2023

Codecov Report

Merging #3996 (917cb50) into master (dd664ef) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #3996   +/-   ##
=======================================
  Coverage   99.58%   99.58%           
=======================================
  Files         351      351           
  Lines       30755    30766   +11     
=======================================
+ Hits        30626    30637   +11     
  Misses        129      129           
Impacted Files Coverage Δ
pennylane/resource/resource.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

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

@soranjh soranjh left a comment

Choose a reason for hiding this comment

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

Thanks @Jaybsoni, looks great. Left some comments and questions. My major point is on the optional support for decomposition of standard PL gates, if they have a decomposition method.

pennylane/resource/__init__.py Outdated Show resolved Hide resolved
pennylane/resource/__init__.py Outdated Show resolved Hide resolved
pennylane/resource/resource.py Outdated Show resolved Hide resolved
pennylane/resource/resource.py Outdated Show resolved Hide resolved
pennylane/resource/resource.py Show resolved Hide resolved
tests/resource/test_resource.py Show resolved Hide resolved
tests/resource/test_resource.py Outdated Show resolved Hide resolved
@albi3ro albi3ro added this to the Release v0.30 milestone Apr 17, 2023
pennylane/resource/resource.py Outdated Show resolved Hide resolved
Jaybsoni and others added 2 commits April 18, 2023 14:37
Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com>
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.

Thanks Jay. Is the plan to merge this before the circuit graph PR or after?

tests/resource/test_resource.py Outdated Show resolved Hide resolved
@Jaybsoni
Copy link
Contributor Author

Probably will merge this first and then address that PR afterwards

Base automatically changed from resource_class to master April 19, 2023 18:55
@Jaybsoni Jaybsoni enabled auto-merge (squash) April 19, 2023 19:48
@Jaybsoni Jaybsoni merged commit 99d53c6 into master Apr 19, 2023
@Jaybsoni Jaybsoni deleted the resource_function branch April 19, 2023 20:29
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.

5 participants