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

update more spots that use MP.name #5076

Merged
merged 4 commits into from
Jan 17, 2024
Merged

Conversation

timmysilv
Copy link
Contributor

Same as #5071 but in other places.

I'm a little worried that maybe we shouldn't deprecate MeasurementProcess.name at all... seems like we kinda depend on it? My first thought was to just make them more correct (eg. "State", "Probs"), but I don't think any devices have those saved in their dev.observables so I suppose this might still be the best way forward

@timmysilv timmysilv requested a review from a team January 17, 2024 15:02
Copy link

codecov bot commented Jan 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c01cb4b) 99.67% compared to head (a1d31e1) 99.67%.
Report is 24 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5076      +/-   ##
==========================================
- Coverage   99.67%   99.67%   -0.01%     
==========================================
  Files         394      394              
  Lines       35670    35462     -208     
==========================================
- Hits        35554    35346     -208     
  Misses        116      116              

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

@josh146
Copy link
Member

josh146 commented Jan 17, 2024

@timmysilv I could provide some context if needed since (I think??) I originally added this. The original motivation was mostly repr/printing for end users (so that circuits would show as qml.expval(qml.PauliZ) when displayed etc.)

@timmysilv
Copy link
Contributor Author

@josh146 we're deprecating MeasurementProcess.name and MeasurementProcess.data, because they were always "Identity" and [], respectively (see file at time of adding). Every time we checked MP.name, it was "Identity", even today:

>>> qml.state().name
/Users/matthews/src/github.com/PennyLaneAI/pennylane/pennylane/measurements/measurements.py:196: PennyLaneDeprecationWarning: MeasurementProcess.name is deprecated, and will be removed in an upcoming release. To get the name of an observable from a measurement, use MeasurementProcess.obs.name instead
  warn(
'Identity'

that said, Device clearly does check it and handle it, even though it was always "Identity". While I hoped this wouldn't affect things, it still can sometimes as we're seeing.

@josh146
Copy link
Member

josh146 commented Jan 17, 2024

got it, thanks @timmysilv!

@lillian542 lillian542 requested a review from a team January 17, 2024 17:20
@timmysilv timmysilv enabled auto-merge (squash) January 17, 2024 19:50
@timmysilv timmysilv merged commit c71d850 into master Jan 17, 2024
34 checks passed
@timmysilv timmysilv deleted the check-is-mp-first-again branch January 17, 2024 20:06
mudit2812 pushed a commit that referenced this pull request Jan 19, 2024
Same as #5071 but in other places.

I'm a little worried that maybe we shouldn't deprecate
`MeasurementProcess.name` at all... seems like we kinda depend on it? My
first thought was to just make them more correct (eg. "State", "Probs"),
but I don't think any devices have those saved in their
`dev.observables` so I suppose this might still be the best way forward
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.

4 participants