def validate_gt_label(label: torch.Tensor | None) -> torch.Tensor | None:
        """Validate the ground truth labels for a batch.

        Validates that the input ground truth labels have the correct data type and
        format. Converts labels to boolean type.

        Args:
            label (torch.Tensor | None): Input ground truth labels. Should be a 1D tensor
                of boolean or integer values.

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

        Raises:
            TypeError: If ``label`` is not a ``torch.Tensor`` or has invalid dtype.

        Examples:
            >>> import torch
            >>> from anomalib.data.validators import VideoBatchValidator
            >>> gt_labels = torch.tensor([0, 1, 1, 0])
            >>> validated_labels = VideoBatchValidator.validate_gt_label(gt_labels)
            >>> print(validated_labels)
            tensor([False,  True,  True, False])
        """
        if label is None:
            return None
        if not isinstance(label, torch.Tensor):
            msg = f"Ground truth labels must be a torch.Tensor, got {type(label)}."
            raise TypeError(msg)
        if torch.is_floating_point(label):
            msg = f"Ground truth labels must be boolean or integer, got {label.dtype}."
            raise TypeError(msg)
        return label.bool()
Validate the ground truth labels for a batch.

        Validates that the input ground truth labels have the correct data type and
        format. Converts labels to boolean type.

        Args:
            label (torch.Tensor | None): Input ground truth labels. Should be a 1D tensor
                of boolean or integer values.

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

        Raises:
            TypeError: If ``label`` is not a ``torch.Tensor`` or has invalid dtype.

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