def validate_gt_label(gt_label: torch.Tensor | Sequence[int] | None) -> torch.Tensor | None:
        """Validate the ground truth label for a batch.

        This method validates batches of ground truth labels. It handles:
            - Conversion to torch.Tensor if needed
            - Type conversion to boolean
            - Shape validation

        Args:
            gt_label (``torch.Tensor`` | ``Sequence[int]`` | ``None``): Input ground truth
                label.

        Returns:
            ``torch.Tensor`` | ``None``: Validated ground truth label as a boolean tensor,
                or None.

        Raises:
            TypeError: If ``gt_label`` is not a sequence of integers or torch.Tensor.
            ValueError: If ``gt_label`` shape or data type is invalid.

        Example:
            Validate ground truth labels::

                >>> import torch
                >>> from anomalib.data.validators import ImageBatchValidator
                >>> gt_label = torch.tensor([0, 1, 1, 0])
                >>> validated = ImageBatchValidator.validate_gt_label(gt_label)
                >>> validated
                tensor([False,  True,  True, False])
        """
        if gt_label is None:
            return None
        if isinstance(gt_label, Sequence):
            gt_label = torch.tensor(gt_label)
        if not isinstance(gt_label, torch.Tensor):
            msg = f"Ground truth label must be a sequence of integers or a torch.Tensor, got {type(gt_label)}."
            raise TypeError(msg)
        if gt_label.ndim != 1:
            msg = f"Ground truth label must be a 1-dimensional vector, got shape {gt_label.shape}."
            raise ValueError(msg)
        if torch.is_floating_point(gt_label):
            msg = f"Ground truth label must be boolean or integer, got {gt_label}."
            raise ValueError(msg)
        return gt_label.bool()
Validate the ground truth label for a batch.

        This method validates batches of ground truth labels. It handles:
            - Conversion to torch.Tensor if needed
            - Type conversion to boolean
            - Shape validation

        Args:
            gt_label (``torch.Tensor`` | ``Sequence[int]`` | ``None``): Input ground truth
                label.

        Returns:
            ``torch.Tensor`` | ``None``: Validated ground truth label as a boolean tensor,
                or None.

        Raises:
            TypeError: If ``gt_label`` is not a sequence of integers or torch.Tensor.
            ValueError: If ``gt_label`` shape or data type is invalid.

        Example:
            Validate ground truth labels::

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