diff --git a/pytorch_lightning/utilities/metrics.py b/pytorch_lightning/utilities/metrics.py index 0c6ade8082..d10f9a8045 100644 --- a/pytorch_lightning/utilities/metrics.py +++ b/pytorch_lightning/utilities/metrics.py @@ -27,13 +27,13 @@ def metrics_to_scalars(metrics: Any) -> Any: Raises: MisconfigurationException: - If ``value`` contains multiple elements, hence preventing conversion to ``float`` + If tensors inside ``metrics`` contains multiple elements, hence preventing conversion to a scalar. """ def to_item(value: torch.Tensor) -> numbers.Number: if value.numel() != 1: raise MisconfigurationException( - f"The metric `{value}` does not contain a single element" f" thus it cannot be converted to float." + f"The metric `{value}` does not contain a single element, thus it cannot be converted to a scalar." ) return value.item()