Skip to content

add available device to regression tests #3335 #3394

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

Conversation

BanzaiTokyo
Copy link
Collaborator

No description provided.

@BanzaiTokyo BanzaiTokyo changed the title add available device to test_canberra_metric.py #3335 add available device to integration tests #3335 Apr 24, 2025
@github-actions github-actions bot added the module: metrics Metrics module label Apr 24, 2025
@BanzaiTokyo BanzaiTokyo force-pushed the regression_tests_add_available_device branch from ae57e4b to f99b643 Compare April 24, 2025 14:52
@BanzaiTokyo BanzaiTokyo force-pushed the regression_tests_add_available_device branch from 1b9ee36 to 3dbbe1e Compare April 24, 2025 20:12
@BanzaiTokyo BanzaiTokyo force-pushed the regression_tests_add_available_device branch 2 times, most recently from 9b1e5fe to b87df91 Compare April 24, 2025 22:43
@BanzaiTokyo BanzaiTokyo force-pushed the regression_tests_add_available_device branch from b87df91 to 6f0599d Compare April 24, 2025 22:56
Copy link
Collaborator

@vfdev-5 vfdev-5 left a comment

Choose a reason for hiding this comment

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

I left few comments. Now this PR starts being too large, let's split it and work chunk by chunk.

@BanzaiTokyo BanzaiTokyo marked this pull request as ready for review April 25, 2025 09:37
@BanzaiTokyo BanzaiTokyo changed the title add available device to integration tests #3335 add available device to regression tests #3335 Apr 28, 2025
@BanzaiTokyo
Copy link
Collaborator Author

@vfdev-5 I believe I have addressed your comments, please, review again to make sure everything is ok

Copy link
Collaborator

@vfdev-5 vfdev-5 left a comment

Choose a reason for hiding this comment

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

Let's split this PR into multiple ones and make them merge once you are done porting 1 or 2 metrics. We want to do the following:

  • add available_device
  • use tensor API instead of numpy for data creation
  • rewrite test_integration tests using pytest parametrize instead of nested _test methods

Comment on lines +122 to +128
denom = y_pred_var * y_var
denom = torch.clamp(denom, min=self.eps)
denom = torch.sqrt(denom)
r = cov / denom

if torch.isnan(r):
return 0.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why this change ? Have you checked with the original implementation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

just to make sure I ran the tests once again. Without this snippet, on MPS a division by zero produces NaN:

FAILED tests/ignite/metrics/regression/test_pearson_correlation.py::test_degenerated_sample[mps] - assert 0.0 ± 1.0e-12 == nan
  
  comparison failed
  Obtained: nan
  Expected: 0.0 ± 1.0e-12

@BanzaiTokyo BanzaiTokyo force-pushed the regression_tests_add_available_device branch from 09d4913 to 346e0e1 Compare May 2, 2025 12:59
@BanzaiTokyo BanzaiTokyo closed this May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: metrics Metrics module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants