def _normalize(
        pred_scores: torch.Tensor | np.float32,
        metadata: dict | DictConfig,
        anomaly_maps: torch.Tensor | np.ndarray | None = None,
    ) -> tuple[np.ndarray | torch.Tensor | None, float]:
        """Normalize predictions using min-max normalization.

        Args:
            pred_scores (torch.Tensor | np.float32): Predicted anomaly scores.
            metadata (dict | DictConfig): Metadata containing normalization
                parameters.
            anomaly_maps (torch.Tensor | np.ndarray | None): Raw anomaly maps.
                Defaults to None.

        Returns:
            tuple[np.ndarray | torch.Tensor | None, float]: Normalized predictions
                and scores.

        Example:
            >>> scores = torch.tensor(0.5)
            >>> metadata = {
            ...     "image_threshold": 0.5,
            ...     "pred_scores.min": 0.0,
            ...     "pred_scores.max": 1.0
            ... }
            >>> maps, norm_scores = Inferencer._normalize(scores, metadata)
            >>> norm_scores
            0.5
        """
        # min max normalization
        if "pred_scores.min" in metadata and "pred_scores.max" in metadata:
            if anomaly_maps is not None and "anomaly_maps.max" in metadata:
                anomaly_maps = normalize_min_max(
                    anomaly_maps,
                    metadata["pixel_threshold"],
                    metadata["anomaly_maps.min"],
                    metadata["anomaly_maps.max"],
                )
            pred_scores = normalize_min_max(
                pred_scores,
                metadata["image_threshold"],
                metadata["pred_scores.min"],
                metadata["pred_scores.max"],
            )

        return anomaly_maps, float(pred_scores)
Normalize predictions using min-max normalization.

        Args:
            pred_scores (torch.Tensor | np.float32): Predicted anomaly scores.
            metadata (dict | DictConfig): Metadata containing normalization
                parameters.
            anomaly_maps (torch.Tensor | np.ndarray | None): Raw anomaly maps.
                Defaults to None.

        Returns:
            tuple[np.ndarray | torch.Tensor | None, float]: Normalized predictions
                and scores.

        Example:
            >>> scores = torch.tensor(0.5)
            >>> metadata = {
            ...     "image_threshold": 0.5,
            ...     "pred_scores.min": 0.0,
            ...     "pred_scores.max": 1.0
            ... }
            >>> maps, norm_scores = Inferencer._normalize(scores, metadata)
            >>> norm_scores
            0.5
        
src/anomalib/deploy/inferencers/base_inferencer.py