def _binary_precision_recall_curve_format(
        preds: Tensor,
        target: Tensor,
        thresholds: int | list[float] | Tensor | None = None,
        ignore_index: int | None = None,
    ) -> tuple[Tensor, Tensor, Tensor | None]:
        """Format predictions and targets for binary precision-recall curve.

        Similar to torchmetrics' ``_binary_precision_recall_curve_format`` but
        without sigmoid normalization of predictions.

        Args:
            preds (Tensor): Predicted scores or probabilities
            target (Tensor): Ground truth binary labels
            thresholds (int | list[float] | Tensor | None, optional): Thresholds
                used for computing curve points. Defaults to ``None``.
            ignore_index (int | None, optional): Label to ignore in evaluation.
                Defaults to ``None``.

        Returns:
            tuple[Tensor, Tensor, Tensor | None]: Tuple containing:
                - Flattened predictions
                - Flattened targets
                - Adjusted thresholds
        """
        preds = preds.flatten()
        target = target.flatten()
        if ignore_index is not None:
            idx = target != ignore_index
            preds = preds[idx]
            target = target[idx]

        thresholds = _adjust_threshold_arg(thresholds, preds.device)
        return preds, target, thresholds
Format predictions and targets for binary precision-recall curve.

        Similar to torchmetrics' ``_binary_precision_recall_curve_format`` but
        without sigmoid normalization of predictions.

        Args:
            preds (Tensor): Predicted scores or probabilities
            target (Tensor): Ground truth binary labels
            thresholds (int | list[float] | Tensor | None, optional): Thresholds
                used for computing curve points. Defaults to ``None``.
            ignore_index (int | None, optional): Label to ignore in evaluation.
                Defaults to ``None``.

        Returns:
            tuple[Tensor, Tensor, Tensor | None]: Tuple containing:
                - Flattened predictions
                - Flattened targets
                - Adjusted thresholds
        
src/anomalib/metrics/precision_recall_curve.py