Skip to content

Conversation

@jzaia18
Copy link
Contributor

@jzaia18 jzaia18 commented Nov 28, 2025

Context:
qml.specs makes very few guarantees on the shape of its output. This PR aims to make a single unified out type for qml.specs, which contains all of (and only) the information needed for circuit inspection.

Description of the Change:

  • Introduces new SpecsResources and SpecsResult classes
  • Refactors various specs functions throughout PennyLane to make use of the new classes

Benefits:
Cleaner and more consistent specs returns.

Possible Drawbacks:
Introduces another "resources" object into PennyLane. A followup PR should restructure these PRs such that all of them inherit from a common base class.

Related GitHub Issues:
[sc-104965]

@jzaia18 jzaia18 requested a review from AntonNI8 November 28, 2025 23:10
@jzaia18 jzaia18 self-assigned this Nov 28, 2025
@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.

tape_resources.gate_sizes,
tape_resources.depth,
Shots(shots_from_dev),
resources = SpecsResources( # temporary until shots get updated on tape !
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
resources = SpecsResources( # temporary until shots get updated on tape !
resources = SpecsResources(

Should I remove this comment? It seems to have been left here for a very long time

"""A special dictionary for storing the specs of a circuit. Used to customize ``KeyError`` messages."""

def __getitem__(self, __k):
if __k == "num_diagonalizing_gates":
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the warning associated with this since this specific field since it was removed back in March (several releases ago).

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.

2 participants