def validate_pred_label(pred_label: np.ndarray | None) -> np.ndarray | None:
        """Validate the prediction label.

        Args:
            pred_label (``np.ndarray`` | ``None``): Input prediction label to validate.

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

        Raises:
            ValueError: If ``pred_label`` cannot be converted to a numpy array or is not
                a scalar.

        Example:
            >>> import numpy as np
            >>> validator = NumpyVideoValidator()
            >>> label = np.array(1)
            >>> validated_label = validator.validate_pred_label(label)
            >>> print(validated_label, validated_label.dtype)
            True bool
        """
        if pred_label is None:
            return None
        if not isinstance(pred_label, np.ndarray):
            try:
                pred_label = np.array(pred_label)
            except Exception as e:
                msg = "Failed to convert pred_label to a numpy.ndarray."
                raise ValueError(msg) from e
        pred_label = pred_label.squeeze()
        if pred_label.ndim != 0:
            msg = f"Predicted label must be a scalar, got shape {pred_label.shape}."
            raise ValueError(msg)
        return pred_label.astype(bool)
Validate the prediction label.

        Args:
            pred_label (``np.ndarray`` | ``None``): Input prediction label to validate.

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

        Raises:
            ValueError: If ``pred_label`` cannot be converted to a numpy array or is not
                a scalar.

        Example:
            >>> import numpy as np
            >>> validator = NumpyVideoValidator()
            >>> label = np.array(1)
            >>> validated_label = validator.validate_pred_label(label)
            >>> print(validated_label, validated_label.dtype)
            True bool
        
src/anomalib/data/validators/numpy/video.py