def joint_validate_thresholds_shared_fpr(
    thresholds: torch.Tensor,
    shared_fpr: torch.Tensor,
) -> None:
    """Validate matching dimensions between thresholds and shared FPR.

    Args:
        thresholds: Tensor of threshold values.
        shared_fpr: Tensor of shared false positive rates.

    Raises:
        ValueError: If tensors have different lengths.

    Example:
        >>> t = torch.linspace(0, 1, 5)
        >>> fpr = torch.zeros(5)
        >>> joint_validate_thresholds_shared_fpr(t, fpr)  # No error
        >>> bad_fpr = torch.zeros(4)
        >>> joint_validate_thresholds_shared_fpr(t, bad_fpr)  # Raises ValueError
    """
    if thresholds.shape[0] != shared_fpr.shape[0]:
        msg = (
            "Expected `thresholds` and `shared_fpr` to have the same number of "
            f"elements, but got {thresholds.shape[0]} != {shared_fpr.shape[0]}"
        )
        raise ValueError(msg)
Validate matching dimensions between thresholds and shared FPR.

    Args:
        thresholds: Tensor of threshold values.
        shared_fpr: Tensor of shared false positive rates.

    Raises:
        ValueError: If tensors have different lengths.

    Example:
        >>> t = torch.linspace(0, 1, 5)
        >>> fpr = torch.zeros(5)
        >>> joint_validate_thresholds_shared_fpr(t, fpr)  # No error
        >>> bad_fpr = torch.zeros(4)
        >>> joint_validate_thresholds_shared_fpr(t, bad_fpr)  # Raises ValueError
    
src/anomalib/metrics/pimo/_validate.py