def validate_gt_label(label: int | torch.Tensor | None) -> torch.Tensor | None:
        """Validate the ground truth label.

        This method validates and normalizes input labels. It handles:
            - Integer and tensor inputs
            - Type conversion to boolean
            - Scalar values only

        Args:
            label (``int`` | ``torch.Tensor`` | ``None``): Input ground truth label.

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

        Raises:
            TypeError: If ``label`` is neither an integer nor a torch.Tensor.
            ValueError: If ``label`` shape is invalid.

        Example:
            Validate integer and tensor labels::

                >>> from anomalib.data.validators import DepthValidator
                >>> label_int = 1
                >>> validated = DepthValidator.validate_gt_label(label_int)
                >>> validated
                tensor(True)
                >>> label_tensor = torch.tensor(0)
                >>> validated = DepthValidator.validate_gt_label(label_tensor)
                >>> validated
                tensor(False)
        """
        if label is None:
            return None
        if isinstance(label, int | np.integer):
            label = torch.tensor(int(label))
        if not isinstance(label, torch.Tensor):
            msg = f"Ground truth label must be an integer or a torch.Tensor, got {type(label)}."
            raise TypeError(msg)
        if label.ndim != 0:
            msg = f"Ground truth label must be a scalar, got shape {label.shape}."
            raise ValueError(msg)
        if torch.is_floating_point(label):
            msg = f"Ground truth label must be boolean or integer, got {label.dtype}."
            raise TypeError(msg)
        return label.bool()
Validate the ground truth label.

        This method validates and normalizes input labels. It handles:
            - Integer and tensor inputs
            - Type conversion to boolean
            - Scalar values only

        Args:
            label (``int`` | ``torch.Tensor`` | ``None``): Input ground truth label.

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

        Raises:
            TypeError: If ``label`` is neither an integer nor a torch.Tensor.
            ValueError: If ``label`` shape is invalid.

        Example:
            Validate integer and tensor labels::

                >>> from anomalib.data.validators import DepthValidator
                >>> label_int = 1
                >>> validated = DepthValidator.validate_gt_label(label_int)
                >>> validated
                tensor(True)
                >>> label_tensor = torch.tensor(0)
                >>> validated = DepthValidator.validate_gt_label(label_tensor)
                >>> validated
                tensor(False)
        
src/anomalib/data/validators/torch/depth.py