def is_valid_threshold(thresholds: Tensor) -> None:
    """Validate that thresholds are valid and monotonically increasing.

    Args:
        thresholds: Tensor of threshold values.

    Raises:
        TypeError: If ``thresholds`` is not a floating point Tensor.
        ValueError: If ``thresholds`` is not 1D or not strictly increasing.

    Example:
        >>> thresholds = torch.tensor([0.1, 0.2, 0.3])
        >>> is_valid_threshold(thresholds)  # No error
        >>> bad_thresholds = torch.tensor([0.3, 0.2, 0.1])
        >>> is_valid_threshold(bad_thresholds)  # Raises ValueError
        ValueError: Expected thresholds to be strictly increasing
    """
    if not isinstance(thresholds, Tensor):
        msg = f"Expected thresholds to be an Tensor, but got {type(thresholds)}"
        raise TypeError(msg)

    if thresholds.ndim != 1:
        msg = f"Expected thresholds to be 1D, but got {thresholds.ndim}"
        raise ValueError(msg)

    if not thresholds.dtype.is_floating_point:
        msg = f"Expected thresholds to be of float type, but got Tensor with dtype {thresholds.dtype}"
        raise TypeError(msg)

    # make sure they are strictly increasing
    if not torch.all(torch.diff(thresholds) > 0):
        msg = "Expected thresholds to be strictly increasing, but it is not."
        raise ValueError(msg)
Validate that thresholds are valid and monotonically increasing.

    Args:
        thresholds: Tensor of threshold values.

    Raises:
        TypeError: If ``thresholds`` is not a floating point Tensor.
        ValueError: If ``thresholds`` is not 1D or not strictly increasing.

    Example:
        >>> thresholds = torch.tensor([0.1, 0.2, 0.3])
        >>> is_valid_threshold(thresholds)  # No error
        >>> bad_thresholds = torch.tensor([0.3, 0.2, 0.1])
        >>> is_valid_threshold(bad_thresholds)  # Raises ValueError
        ValueError: Expected thresholds to be strictly increasing
    
src/anomalib/metrics/pimo/_validate.py