def validate_pred_label(pred_label: torch.Tensor | None) -> torch.Tensor | None:
        """Validate the prediction labels for a batch.

        Validates that the input prediction labels have the correct format and converts
        them to boolean type.

        Args:
            pred_label (torch.Tensor | None): Input prediction labels. Should be a 1D
                tensor of boolean or numeric values.

        Returns:
            torch.Tensor | None: Validated prediction labels as boolean tensor.

        Raises:
            ValueError: If prediction labels have invalid shape or cannot be converted to
                tensor.

        Examples:
            >>> import torch
            >>> from anomalib.data.validators import VideoBatchValidator
            >>> pred_labels = torch.tensor([0, 1, 1, 0])
            >>> validated_labels = VideoBatchValidator.validate_pred_label(pred_labels)
            >>> print(validated_labels)
            tensor([False,  True,  True, False])
        """
        if pred_label is None:
            return None
        if not isinstance(pred_label, torch.Tensor):
            try:
                pred_label = torch.tensor(pred_label)
            except Exception as e:
                msg = "Failed to convert pred_label to a torch.Tensor."
                raise ValueError(msg) from e
        if pred_label.ndim != 1:
            msg = f"Predicted labels must be a 1D tensor, got shape {pred_label.shape}."
            raise ValueError(msg)
        return pred_label.to(torch.bool)
Validate the prediction labels for a batch.

        Validates that the input prediction labels have the correct format and converts
        them to boolean type.

        Args:
            pred_label (torch.Tensor | None): Input prediction labels. Should be a 1D
                tensor of boolean or numeric values.

        Returns:
            torch.Tensor | None: Validated prediction labels as boolean tensor.

        Raises:
            ValueError: If prediction labels have invalid shape or cannot be converted to
                tensor.

        Examples:
            >>> import torch
            >>> from anomalib.data.validators import VideoBatchValidator
            >>> pred_labels = torch.tensor([0, 1, 1, 0])
            >>> validated_labels = VideoBatchValidator.validate_pred_label(pred_labels)
            >>> print(validated_labels)
            tensor([False,  True,  True, False])
        
src/anomalib/data/validators/torch/video.py