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

        This method validates batches of prediction labels. It handles:
            - Shape normalization
            - Type conversion to boolean

        Args:
            pred_label (``torch.Tensor`` | ``None``): Input prediction label.

        Returns:
            ``torch.Tensor`` | ``None``: Validated prediction label as boolean tensor,
                or None.

        Raises:
            TypeError: If ``pred_label`` is not a torch.Tensor.
            ValueError: If ``pred_label`` has invalid shape.

        Example:
            Validate prediction labels::

                >>> import torch
                >>> from anomalib.data.validators import ImageBatchValidator
                >>> pred_label = torch.tensor([[1], [0], [1], [1]])
                >>> validated = ImageBatchValidator.validate_pred_label(pred_label)
                >>> validated
                tensor([ True, False,  True,  True])
        """
        if pred_label is None:
            return None
        if not isinstance(pred_label, torch.Tensor):
            msg = f"Predicted label must be a torch.Tensor, got {type(pred_label)}."
            raise TypeError(msg)
        if pred_label.ndim > 2:
            msg = f"Predicted label must be 1-dimensional or 2-dimensional, got shape {pred_label.shape}."
            raise ValueError(msg)
        if pred_label.ndim == 2:
            if pred_label.shape[0] == 1:
                pred_label = pred_label.squeeze(0)
            elif pred_label.shape[1] == 1:
                pred_label = pred_label.squeeze(1)
            else:
                msg = (
                    f"Predicted label with 2 dimensions must have shape [N, 1] or [1, N], got shape {pred_label.shape}."
                )
                raise ValueError(msg)
        return pred_label.to(torch.bool)
Validate the prediction label for a batch.

        This method validates batches of prediction labels. It handles:
            - Shape normalization
            - Type conversion to boolean

        Args:
            pred_label (``torch.Tensor`` | ``None``): Input prediction label.

        Returns:
            ``torch.Tensor`` | ``None``: Validated prediction label as boolean tensor,
                or None.

        Raises:
            TypeError: If ``pred_label`` is not a torch.Tensor.
            ValueError: If ``pred_label`` has invalid shape.

        Example:
            Validate prediction labels::

                >>> import torch
                >>> from anomalib.data.validators import ImageBatchValidator
                >>> pred_label = torch.tensor([[1], [0], [1], [1]])
                >>> validated = ImageBatchValidator.validate_pred_label(pred_label)
                >>> validated
                tensor([ True, False,  True,  True])
        
src/anomalib/data/validators/torch/image.py