Skip to content

Fix the torch_metric shape error #2786

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

Merged
merged 3 commits into from
Apr 28, 2025

Conversation

cnhwl
Copy link
Contributor

@cnhwl cnhwl commented Apr 21, 2025

Checklist before merging this PR:

  • Mentioned all issues that this PR fixes or addresses.
  • Summarized the updates of this PR under Summary.
  • Added an entry under Unreleased in the Changelog.

Fixes #2785.

Summary

Reshape the pred and target regardless of whether self.n_targets > 1, to satisfy some torch_metrics such as R2Score(preds.ndim <= 2)

Copy link

codecov bot commented Apr 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.50%. Comparing base (7eeb6dd) to head (52fd288).
Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2786       +/-   ##
===========================================
+ Coverage   41.21%   94.50%   +53.28%     
===========================================
  Files         228      145       -83     
  Lines       35437    15455    -19982     
===========================================
- Hits        14607    14605        -2     
+ Misses      20830      850    -19980     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@dennisbader dennisbader left a comment

Choose a reason for hiding this comment

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

Thanks a lot for fixing this bug @cnhwl, it looks great 🚀 🥳 💯

@dennisbader dennisbader merged commit 21cfea2 into unit8co:master Apr 28, 2025
9 checks passed
@cnhwl cnhwl deleted the Fix/torch_metrics_shape_error branch April 29, 2025 02:17
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.

[BUG] when using torch_metrics, a single metric is ok, but metric collection error
2 participants