def _get_linspaced_thresholds(anomaly_maps: torch.Tensor, num_thresholds: int) -> torch.Tensor:
    """Get linearly spaced thresholds between min and max anomaly scores.

    Args:
        anomaly_maps: Anomaly score maps
        num_thresholds: Number of thresholds to generate

    Returns:
        Linearly spaced thresholds of shape ``(num_thresholds,)``

    Raises:
        ValueError: If threshold bounds are invalid
    """
    _validate.is_num_thresholds_gte2(num_thresholds)
    # this operation can be a bit expensive
    thresh_low, thresh_high = thresh_bounds = (anomaly_maps.min().item(), anomaly_maps.max().item())
    try:
        _validate.validate_threshold_bounds(thresh_bounds)
    except ValueError as ex:
        msg = f"Invalid threshold bounds computed from the given anomaly maps. Cause: {ex}"
        raise ValueError(msg) from ex
    return torch.linspace(thresh_low, thresh_high, num_thresholds, dtype=anomaly_maps.dtype)
Get linearly spaced thresholds between min and max anomaly scores.

    Args:
        anomaly_maps: Anomaly score maps
        num_thresholds: Number of thresholds to generate

    Returns:
        Linearly spaced thresholds of shape ``(num_thresholds,)``

    Raises:
        ValueError: If threshold bounds are invalid
    
src/anomalib/metrics/pimo/binary_classification_curve.py