import torch


def one_hot_to_class_indices(labels: torch.Tensor) -> torch.Tensor:
    """
    Converts one hot encoded label tensor to a tensor representing class ids.

    :param labels: One-hot encoded label tensor
    """
    # Check that labels do not overlap with each other
    if not labels.is_floating_point():
        raise TypeError("Input `label` tensor is not a float tensor")

    if not (labels.sum(dim=1) == 1.0).all():
        raise ValueError("Input `label` tensor contains multiple foreground labels for some pixels")

    # Derive class indices
    _, class_ids = labels.max(dim=1)

    return class_ids