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

        Args:
            label (``int`` | ``np.ndarray`` | ``None``): Input label to validate.

        Returns:
            ``np.ndarray`` | ``None``: Validated label as boolean numpy array, or None if
                input is None.

        Raises:
            TypeError: If ``label`` is not an integer or numpy array.
            ValueError: If ``label`` is not a scalar.

        Example:
            >>> validator = NumpyVideoValidator()
            >>> label = 1
            >>> validated_label = validator.validate_gt_label(label)
            >>> print(validated_label, validated_label.dtype)
            True bool
        """
        if label is None:
            return None
        if isinstance(label, int):
            label = np.array(label)
        if not isinstance(label, np.ndarray):
            msg = f"Ground truth label must be an integer or a numpy.ndarray, 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 not np.issubdtype(label.dtype, np.integer):
            msg = f"Ground truth label must be boolean or integer, got {label.dtype}."
            raise TypeError(msg)
        return label.astype(bool)
Validate the ground truth label.

        Args:
            label (``int`` | ``np.ndarray`` | ``None``): Input label to validate.

        Returns:
            ``np.ndarray`` | ``None``: Validated label as boolean numpy array, or None if
                input is None.

        Raises:
            TypeError: If ``label`` is not an integer or numpy array.
            ValueError: If ``label`` is not a scalar.

        Example:
            >>> validator = NumpyVideoValidator()
            >>> label = 1
            >>> validated_label = validator.validate_gt_label(label)
            >>> print(validated_label, validated_label.dtype)
            True bool
        
src/anomalib/data/validators/numpy/video.py