PennyLaneAI / pennylane

PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
https://pennylane.ai
Apache License 2.0
2.17k stars 568 forks source link

add error on processing queue if object does not have a `_queue_category` #5866

Closed albi3ro closed 1 week ago

albi3ro commented 1 week ago

Context:

Description of the Change:

Adds an error to qml.queuing.process_queue if it encounters an object without a _queue_category property that sorts it into the operations or measurements queue.

Benefits:

An informative error instead of silently ignoring objects in the queue.

Possible Drawbacks:

Non-circuit objects can still be placed into an AnnotatedQueue. qml.apply still works on non-circuit objects.

We still silently ignore objects with a _queue_category == None, like Hermitian or SparseHamiltonian. We should fix the queuing behavior of these observables at some point, but we can do that later.

Related GitHub Issues:

Fixes #5865 , [sc-66169]

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.67%. Comparing base (9d79f5d) to head (61723dc).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #5866 +/- ## ========================================== - Coverage 99.68% 99.67% -0.01% ========================================== Files 421 421 Lines 40461 40168 -293 ========================================== - Hits 40332 40038 -294 - Misses 129 130 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.