def validate_pred_score(
        pred_score: torch.Tensor | np.ndarray | Sequence[float] | None,
    ) -> torch.Tensor | None:
        """Validate the prediction scores for a batch.

        This method validates batches of prediction scores. It handles:
            - Conversion from numpy arrays and sequences
            - Type conversion to float32

        Args:
            pred_score (``torch.Tensor`` | ``Sequence[float]`` | ``None``): Input prediction
                scores.

        Returns:
            ``torch.Tensor`` | ``None``: Validated prediction scores as float32 tensor,
                or None.

        Raises:
            TypeError: If ``pred_score`` is not a valid input type.
            ValueError: If ``pred_score`` cannot be converted to tensor.

        Example:
            Validate prediction scores::

                >>> import torch
                >>> from anomalib.data.validators import ImageBatchValidator
                >>> scores = [0.8, 0.7, 0.9]
                >>> validated = ImageBatchValidator.validate_pred_score(scores)
                >>> validated
                tensor([0.8000, 0.7000, 0.9000])
        """
        if pred_score is None:
            return None

        if isinstance(pred_score, Sequence):
            pred_score = torch.tensor(pred_score)
        if not isinstance(pred_score, torch.Tensor):
            try:
                pred_score = torch.tensor(pred_score)
            except Exception as e:
                msg = "Failed to convert pred_score to a torch.Tensor."
                raise ValueError(msg) from e

        return pred_score.to(torch.float32)
Validate the prediction scores for a batch.

        This method validates batches of prediction scores. It handles:
            - Conversion from numpy arrays and sequences
            - Type conversion to float32

        Args:
            pred_score (``torch.Tensor`` | ``Sequence[float]`` | ``None``): Input prediction
                scores.

        Returns:
            ``torch.Tensor`` | ``None``: Validated prediction scores as float32 tensor,
                or None.

        Raises:
            TypeError: If ``pred_score`` is not a valid input type.
            ValueError: If ``pred_score`` cannot be converted to tensor.

        Example:
            Validate prediction scores::

                >>> import torch
                >>> from anomalib.data.validators import ImageBatchValidator
                >>> scores = [0.8, 0.7, 0.9]
                >>> validated = ImageBatchValidator.validate_pred_score(scores)
                >>> validated
                tensor([0.8000, 0.7000, 0.9000])
        
src/anomalib/data/validators/torch/image.py