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

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

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

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

        Example:
            >>> import numpy as np
            >>> validator = NumpyVideoBatchValidator()
            >>> labels = np.array([0, 1, 1, 0])
            >>> validated_labels = validator.validate_pred_label(labels)
            >>> print(validated_labels, validated_labels.dtype)
            [False  True  True False] bool
        """
        if pred_label is None:
            return None
        if not isinstance(pred_label, np.ndarray):
            msg = f"Prediction label batch must be a numpy.ndarray, got {type(pred_label)}."
            raise TypeError(msg)
        if pred_label.ndim != 1:
            msg = f"Prediction label batch must be 1-dimensional, got shape {pred_label.shape}."
            raise ValueError(msg)
        return pred_label.astype(bool)
Validate the prediction label batch.

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

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

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

        Example:
            >>> import numpy as np
            >>> validator = NumpyVideoBatchValidator()
            >>> labels = np.array([0, 1, 1, 0])
            >>> validated_labels = validator.validate_pred_label(labels)
            >>> print(validated_labels, validated_labels.dtype)
            [False  True  True False] bool
        
src/anomalib/data/validators/numpy/video.py