Skip to content

Commit c01b68b

Browse files
SkafteNickiSeanNaren
authored andcommitted
[Docs] Warning on metric states (#4388)
* warning on states * suggestion * Update metrics.rst Co-authored-by: Sean Naren <[email protected]> (cherry picked from commit 4a095e1)
1 parent 5d10a36 commit c01b68b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

docs/source/metrics.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ If ``on_epoch`` is True, the logger automatically logs the end of epoch metric v
7878
self.valid_acc(logits, y)
7979
self.log('valid_acc', self.valid_acc, on_step=True, on_epoch=True)
8080
81-
8281
This metrics API is independent of PyTorch Lightning. Metrics can directly be used in PyTorch as shown in the example:
8382

8483
.. code-block:: python
@@ -105,6 +104,13 @@ This metrics API is independent of PyTorch Lightning. Metrics can directly be us
105104
# total accuracy over all validation batches
106105
total_valid_accuracy = valid_accuracy.compute()
107106
107+
.. note::
108+
109+
Metrics contain internal states that keep track of the data seen so far.
110+
Do not mix metric states across training, validation and testing.
111+
It is highly recommended to re-initialize the metric per mode as
112+
shown in the examples above.
113+
108114
*********************
109115
Implementing a Metric
110116
*********************

0 commit comments

Comments
 (0)