def validate_pred_score(pred_score: np.ndarray | None) -> np.ndarray | None:
        """Validate the prediction scores for a batch.

        Args:
            pred_score (``np.ndarray`` | ``None``): Input prediction scores to validate.

        Returns:
            ``np.ndarray`` | ``None``: Validated prediction scores as float32 numpy array,
                or None if input is None.

        Raises:
            TypeError: If the input is not a numpy array.
            ValueError: If the prediction score batch shape is invalid.

        Example:
            >>> import numpy as np
            >>> validator = NumpyVideoBatchValidator()
            >>> scores = np.array([0.1, 0.8, 0.3, 0.6])
            >>> validated_scores = validator.validate_pred_score(scores)
            >>> print(validated_scores, validated_scores.dtype)
            [0.1 0.8 0.3 0.6] float32
        """
        if pred_score is None:
            return None
        if not isinstance(pred_score, np.ndarray):
            msg = f"Prediction score batch must be a numpy.ndarray, got {type(pred_score)}."
            raise TypeError(msg)
        if pred_score.ndim != 1:
            msg = f"Prediction score batch must be 1-dimensional, got shape {pred_score.shape}."
            raise ValueError(msg)
        return pred_score.astype(np.float32)
Validate the prediction scores for a batch.

        Args:
            pred_score (``np.ndarray`` | ``None``): Input prediction scores to validate.

        Returns:
            ``np.ndarray`` | ``None``: Validated prediction scores as float32 numpy array,
                or None if input is None.

        Raises:
            TypeError: If the input is not a numpy array.
            ValueError: If the prediction score batch shape is invalid.

        Example:
            >>> import numpy as np
            >>> validator = NumpyVideoBatchValidator()
            >>> scores = np.array([0.1, 0.8, 0.3, 0.6])
            >>> validated_scores = validator.validate_pred_score(scores)
            >>> print(validated_scores, validated_scores.dtype)
            [0.1 0.8 0.3 0.6] float32
        
src/anomalib/data/validators/numpy/video.py