Skip to content

Commit 1442e53

Browse files
matsumotosanBordaSkafteNicki
authored
deprecate _update_called (#2141)
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com> Co-authored-by: Nicki Skafte Detlefsen <skaftenicki@gmail.com>
1 parent d8a7a55 commit 1442e53

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525

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

28+
### Deprecated
29+
30+
- Deprecated `metric._update_called` ([#2141](https://github.com/Lightning-AI/torchmetrics/pull/2141))
31+
2832

2933
### Removed
3034

src/torchmetrics/detection/mean_ap.py

+1
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ class MeanAveragePrecision(Metric):
348348
"plot_upper_bound",
349349
"plot_legend_name",
350350
"metric_state",
351+
"_update_called",
351352
# below is added for specifically for this metric
352353
"coco",
353354
"cocoeval",

src/torchmetrics/metric.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class Metric(Module, ABC):
8787
"plot_upper_bound",
8888
"plot_legend_name",
8989
"metric_state",
90+
"_update_called",
9091
]
9192
is_differentiable: Optional[bool] = None
9293
higher_is_better: Optional[bool] = None
@@ -168,8 +169,12 @@ def __init__(
168169

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

174179
@property
175180
def update_called(self) -> bool:

0 commit comments

Comments
 (0)