Skip to content

Commit

Permalink
Improve docs on logging in lightning (#582)
Browse files Browse the repository at this point in the history
  • Loading branch information
SkafteNicki authored Oct 25, 2021
1 parent c9c50f7 commit e8ad72e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/source/pages/lightning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ The example below shows how to use a metric in your `LightningModule <https://py
# log epoch metric
self.log('train_acc_epoch', self.accuracy.compute())

.. note::
``self.log`` in Lightning only supports logging of *scalar-tensors*. While the vast majority of metrics in torchmetrics returns a scalar tensor, some metrics such as
:class:`~torchmetrics.ConfusionMatrix`, :class:`~torchmetrics.ROC`, :class:`~torchmetrics.MAP`, :class:`~torchmetrics.RougeScore` return outputs that are non-scalar
tensors (often dicts or list of tensors) and should therefore be dealt with separately. For info about the return type and shape please look at the documentation for
the ``compute`` method for each metric you want to log.

********************
Logging TorchMetrics
********************
Expand Down

0 comments on commit e8ad72e

Please sign in to comment.