def thresholds_between_min_and_max(
    preds: torch.Tensor,
    num_thresholds: int = 100,
    device: torch.device | None = None,
) -> torch.Tensor:
    """Generate evenly spaced threshold values between min and max predictions.

    Args:
        preds (torch.Tensor): Input tensor containing predictions or scores.
        num_thresholds (int, optional): Number of threshold values to generate.
            Defaults to ``100``.
        device (torch.device | None, optional): Device on which to place the
            output tensor. If ``None``, uses the device of input tensor.
            Defaults to ``None``.

    Returns:
        torch.Tensor: A 1D tensor of size ``num_thresholds`` containing evenly
            spaced values between ``preds.min()`` and ``preds.max()``.

    Example:
        >>> preds = torch.tensor([0.1, 0.3, 0.5, 0.7, 0.9])
        >>> thresholds = thresholds_between_min_and_max(preds, num_thresholds=3)
        >>> thresholds
        tensor([0.1000, 0.5000, 0.9000])
    """
    return linspace(start=preds.min(), end=preds.max(), steps=num_thresholds, device=device)
Generate evenly spaced threshold values between min and max predictions.

    Args:
        preds (torch.Tensor): Input tensor containing predictions or scores.
        num_thresholds (int, optional): Number of threshold values to generate.
            Defaults to ``100``.
        device (torch.device | None, optional): Device on which to place the
            output tensor. If ``None``, uses the device of input tensor.
            Defaults to ``None``.

    Returns:
        torch.Tensor: A 1D tensor of size ``num_thresholds`` containing evenly
            spaced values between ``preds.min()`` and ``preds.max()``.

    Example:
        >>> preds = torch.tensor([0.1, 0.3, 0.5, 0.7, 0.9])
        >>> thresholds = thresholds_between_min_and_max(preds, num_thresholds=3)
        >>> thresholds
        tensor([0.1000, 0.5000, 0.9000])
    
src/anomalib/metrics/binning.py