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

deprecate _update_called #2141

Merged
merged 14 commits into from
Oct 17, 2023
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Changed minimum supported Pytorch version from 1.8 to 1.10 ([#2145](https://github.com/Lightning-AI/torchmetrics/pull/2145))

### Deprecated

- Deprecated `metric._update_called` ([#2141](https://github.com/Lightning-AI/torchmetrics/pull/2141))


### Removed

Expand Down
1 change: 1 addition & 0 deletions src/torchmetrics/detection/mean_ap.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ class MeanAveragePrecision(Metric):
"plot_upper_bound",
"plot_legend_name",
"metric_state",
"_update_called",
# below is added for specifically for this metric
"coco",
"cocoeval",
Expand Down
9 changes: 7 additions & 2 deletions src/torchmetrics/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class Metric(Module, ABC):
"plot_upper_bound",
"plot_legend_name",
"metric_state",
"_update_called",
]
is_differentiable: Optional[bool] = None
higher_is_better: Optional[bool] = None
Expand Down Expand Up @@ -168,8 +169,12 @@ def __init__(

@property
def _update_called(self) -> bool:
# TODO: this is needed for internal lightning, remove after v0.12 and update on lightning side
return self._update_count > 0
rank_zero_warn(
"This property will be removed in 2.0.0. Use `Metric.updated_called` instead.",
DeprecationWarning,
stacklevel=2,
)
return self.update_called

@property
def update_called(self) -> bool:
Expand Down