-
Notifications
You must be signed in to change notification settings - Fork 615
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
Deprecate MeasurementProcess.return_type
and ObservableReturnTypes
#6841
base: master
Are you sure you want to change the base?
Deprecate MeasurementProcess.return_type
and ObservableReturnTypes
#6841
Conversation
Hello. You may have forgotten to update the changelog!
|
This reverts commit 9bcec8f.
…-and-`ObservableReturnTypes`
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6841 +/- ##
=======================================
Coverage 99.60% 99.60%
=======================================
Files 476 476
Lines 45194 45185 -9
=======================================
- Hits 45015 45008 -7
+ Misses 179 177 -2 ☔ View full report in Codecov by Sentry. |
…-and-`ObservableReturnTypes`
@@ -56,27 +56,27 @@ def test_serialize_numeric_arguments(self, queue, observable_queue, expected_str | |||
observable3 = qml.prod(qml.PauliZ(0), qml.PauliZ(1)) | |||
|
|||
numeric_observable_queue = [ | |||
(returntype1, observable1, "|||ObservableReturnTypes.Expectation!PauliZ[0]"), | |||
(returntype1, observable1, "|||ExpectationMP!PauliZ[0]"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QQ: after deprecating return type and replacing occurrences with isinstance, we might have to replace the expected output texts in circuit_graph
with the exact class names. Is this a harmless change here? @albi3ro @astralcai
Also, in this module do we have any secondary applications from these return type information?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another question: is doc/development/guide/architecture.rst
also within the scope of deprecations/removals? It defines MP.return_type
there as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QQ: after deprecating return type and replacing occurrences with isinstance, we might have to replace the expected output texts in
circuit_graph
with the exact class names. Is this a harmless change here? @albi3ro @astralcai Also, in this module do we have any secondary applications from these return type information?
I see another usecase in drawer: tape_text.py:_add_measurement
and _add_cwire_measurement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, return_type
has been built into the repr
of MP...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also,
return_type
has been built into therepr
of MP...
solution: make repr
equivalents individually for each subclass of MP.
reason: we definitely want to get rid of the Enum of obs short name list, but on the other hand we should not touch any public interfaces that use these pieces of information.
…None, this should be a QuantumFunctionError, no?
Context:
The
MeasurementProcess.return_type
is only used by the legacy device in a chain ofif mp.return_type.name is ...
checks that can easily be replaced withisinstance
checks.In PL0.40,
return_type
is a property ofMeasurementProcess
which returns None only. Meanwhile,ObservableReturnTypes
is an Enum that defines and wraps the name strings, redundantly.Description of the Change:
return_type
.return_type
with directisinstance
checkObservableReturnTypes
with direct definitions.return_type
: ExpectationMP, ProbabilityMP, SampleMP, StateMP, CountsMP and VarianceMPBenefits:
Less redundancies.
Possible Drawbacks:
any downstreaming usage of the deprecations:
_adjoint_jacobian_base.py
,lightning_base.py
andtest_measurements.py
. Occurrencies here actually block this PRRelated GitHub Issues:
[sc-71892]