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

Fix state reference in MetricCollection #1076

Merged
merged 13 commits into from Jun 8, 2022

Conversation

SkafteNicki
Copy link
Member

@SkafteNicki SkafteNicki commented Jun 7, 2022

What does this PR do?

Fixes #1051
When users call .items(), .values or __getitem__ on a metric collection that have enabled compute groups, the metric states are currently only by referenced, leading to weird results sometimes when metrics in the collection is individually interacted with (as when logging in PL with self.log).
PR fixes this by creating copies (instead of references) when needed.

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃

@SkafteNicki SkafteNicki added the bug / fix Something isn't working label Jun 7, 2022
@codecov
Copy link

codecov bot commented Jun 7, 2022

Codecov Report

Merging #1076 (5abcedd) into master (65594f1) will decrease coverage by 4%.
The diff coverage is 96%.

@@           Coverage Diff           @@
##           master   #1076    +/-   ##
=======================================
- Coverage      95%     90%    -4%     
=======================================
  Files         181     181            
  Lines        8085    8103    +18     
=======================================
- Hits         7654    7315   -339     
- Misses        431     788   +357     

@SkafteNicki SkafteNicki marked this pull request as ready for review June 8, 2022 16:55
@SkafteNicki SkafteNicki added this to the v0.9 milestone Jun 8, 2022
@Borda Borda enabled auto-merge (squash) June 8, 2022 17:04
@Borda Borda disabled auto-merge June 8, 2022 17:04
@Borda Borda enabled auto-merge (squash) June 8, 2022 17:04
@mergify mergify bot added the ready label Jun 8, 2022
@Borda Borda merged commit 3a5b24e into master Jun 8, 2022
@Borda Borda deleted the bugfix/state_reference_metric_collection branch June 8, 2022 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug / fix Something isn't working ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Usage of MetricCollection throws warnings that compute method was called before update.
3 participants