def is_gts_batch(gts_batch: torch.Tensor) -> None:
    """Validate batch of ground truth labels.

    Args:
        gts_batch: Boolean tensor of shape (N, D).

    Raises:
        TypeError: If tensor is not boolean.
        ValueError: If tensor is not 2D.

    Example:
        >>> gts = torch.zeros(10, 5, dtype=torch.bool)
        >>> is_gts_batch(gts)  # No error
        >>> bad_gts = torch.zeros(10, dtype=torch.bool)
        >>> is_gts_batch(bad_gts)  # Raises ValueError
    """
    if not isinstance(gts_batch, torch.Tensor):
        msg = f"Expected `gts_batch` to be an torch.Tensor, but got {type(gts_batch)}"
        raise TypeError(msg)

    if gts_batch.dtype != torch.bool:
        msg = (
            "Expected `gts_batch` to be an boolean torch.Tensor with anomaly "
            f"scores_batch, but got torch.Tensor with dtype {gts_batch.dtype}"
        )
        raise TypeError(msg)

    if gts_batch.ndim != 2:
        msg = f"Expected `gts_batch` to be 2D, but got {gts_batch.ndim}"
        raise ValueError(msg)
Validate batch of ground truth labels.

    Args:
        gts_batch: Boolean tensor of shape (N, D).

    Raises:
        TypeError: If tensor is not boolean.
        ValueError: If tensor is not 2D.

    Example:
        >>> gts = torch.zeros(10, 5, dtype=torch.bool)
        >>> is_gts_batch(gts)  # No error
        >>> bad_gts = torch.zeros(10, dtype=torch.bool)
        >>> is_gts_batch(bad_gts)  # Raises ValueError
    
src/anomalib/metrics/pimo/_validate.py