-
Notifications
You must be signed in to change notification settings - Fork 412
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
Refactor: Imports #1681
Refactor: Imports #1681
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #1681 +/- ##
========================================
- Coverage 89% 61% -28%
========================================
Files 228 228
Lines 12796 12796
========================================
- Hits 11363 7796 -3567
- Misses 1433 5000 +3567 |
TorchMetrics has extremely widespread use. I know we are heading towards 1.0 etc, but I would be very conservative here. I'm in favor of pushing users to import from sub-packages, but I don't think we should wholesale remove root imports just yet. This has a 100% chance of breaking a lot of people's code, and these people don't necessarily care about 0.11 vs 1.0. I would keep root imports in place and just produce deprecation warnings until 2.0. |
ok, this would effectively mean we would create a wrapper class for each of them so also confusing for developers that they won't import source class TotalVariation(Metric):
... # the actual implementation
class TotalVariationDeprecatedImport(TotalVariation):
def __init__(...):
raise DeprecationWarning(...)
super().__init__(...) and for imports: from torchmetrics.image.tv import TotalVariation and from torchmetrics.image.tv import TotalVariationDeprecatedImport as TotalVariation |
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.
lets keep it as updating docstrings
What does this PR do?
Fixes #1654
The following is kept in root:
Metric
andMetricCollection
SumMetric
,MeanMetric
etc.Rest should be imported from domain.
Before submitting
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 🙃