def METHOD_NAME(value: Tensor) -> Union[int, float, bool]:
    if value.numel() != 1:
        raise ValueError(
            f"The metric `{value}` does not contain a single element, thus it cannot be converted to a scalar."
        )
    return value.item()